Skip to content

Commit ae79dfd

Browse files
committed
Remove WF checks for struct fields
1 parent 58b83a2 commit ae79dfd

File tree

2 files changed

+3
-51
lines changed

2 files changed

+3
-51
lines changed

src/lower/mod.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -913,13 +913,11 @@ impl ir::StructDatum {
913913
fn to_program_clauses(&self, program: &ir::Program) -> Vec<ir::ProgramClause> {
914914
// Given:
915915
//
916-
// struct Foo<T: Eq> {
917-
// field: Bar
918-
// }
916+
// struct Foo<T: Eq> { }
919917
//
920918
// we generate the following clause:
921919
//
922-
// for<?T> WF(Foo<?T>) :- WF(?T), WF(Bar), (?T: Eq), WF(?T: Eq).
920+
// for<?T> WF(Foo<?T>) :- WF(?T), (?T: Eq), WF(?T: Eq).
923921

924922
let wf = ir::ProgramClause {
925923
implication: self.binders.map_ref(|bound_datum| {
@@ -934,17 +932,12 @@ impl ir::StructDatum {
934932
.cloned()
935933
.map(|ty| ir::WellFormed::Ty(ty).cast());
936934

937-
let fields = bound_datum.fields
938-
.iter()
939-
.cloned()
940-
.map(|ty| ir::WellFormed::Ty(ty).cast());
941-
942935
let where_clauses = bound_datum.where_clauses.iter()
943936
.cloned()
944937
.flat_map(|wc| wc.expanded(program))
945938
.map(|wc| wc.cast());
946939

947-
tys.chain(fields).chain(where_clauses).collect()
940+
tys.chain(where_clauses).collect()
948941
}
949942
}
950943
}),

src/solve/test.rs

-41
Original file line numberDiff line numberDiff line change
@@ -700,47 +700,6 @@ fn struct_wf() {
700700
}
701701
}
702702

703-
#[test]
704-
fn struct_with_fields_wf() {
705-
test! {
706-
program {
707-
struct Foo { }
708-
709-
struct Bar {
710-
f: Foo
711-
}
712-
713-
trait Clone { }
714-
struct Dummy<T> where T: Clone { }
715-
impl Clone for Foo { }
716-
717-
struct Baz<T> {
718-
f: Dummy<T>
719-
}
720-
}
721-
722-
goal {
723-
WellFormed(Bar)
724-
} yields {
725-
"Unique"
726-
}
727-
728-
// `Bar` does not implement `Clone` so `Dummy<Bar>` is ill-formed
729-
goal {
730-
WellFormed(Baz<Bar>)
731-
} yields {
732-
"No possible solution"
733-
}
734-
735-
// This time `Foo` does implement `Clone`
736-
goal {
737-
WellFormed(Baz<Foo>)
738-
} yields {
739-
"Unique"
740-
}
741-
}
742-
}
743-
744703
#[test]
745704
fn generic_trait() {
746705
test! {

0 commit comments

Comments
 (0)