Skip to content

Commit 99db7c8

Browse files
committed
Handle rebase.
1 parent 06de42f commit 99db7c8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/overlap.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Program {
2727
// goal. In this case, success is an error - it means that there is at
2828
// least one type in the intersection of these two impls.
2929
for (lhs, rhs) in impls.into_iter().tuple_combinations() {
30-
match solver.solve_goal(intersection_of(lhs, rhs)) {
30+
match solver.solve_closed_goal(intersection_of(lhs, rhs)) {
3131
Ok(_) => {
3232
let trait_id = self.type_kinds.get(&trait_id).unwrap().name;
3333
Err(Error::from_kind(ErrorKind::OverlappingImpls(trait_id)))
@@ -46,7 +46,7 @@ impl Program {
4646
// If this goal succeeds, these two impls overlap.
4747
//
4848
// We combine the binders of the two impls & treat them as existential
49-
// quantifiers. Then we attempt to unify the input types to treat provided
49+
// quantifiers. Then we attempt to unify the input types to the trait provided
5050
// by each impl, as well as prove that the where clauses from both impls all
5151
// hold.
5252
//
@@ -62,16 +62,16 @@ impl Program {
6262
// impl<T1, U> Foo<T1> for Vec<U> { }
6363
// impl<T2> Foo<T2> for Vec<i32> { }
6464
// Generates:
65-
// exists<T1, U, T2> { U = i32, T1 = T2 }
65+
// exists<T1, U, T2> { Vec<U> = Vec<i32>, T1 = T2 }
6666
//
6767
//
6868
// Impls:
6969
// impl<T> Foo for Vec<T> where T: Bar { }
7070
// impl<U> Foo for Vec<U> where U: Baz { }
7171
// Generates:
72-
// exists<T, U> { T = U, T: Bar, U: Baz }
72+
// exists<T, U> { Vec<T> = Vec<U>, T: Bar, U: Baz }
7373
//
74-
fn intersection_of(lhs: &ImplDatum, rhs: &ImplDatum) -> Canonical<InEnvironment<Goal>> {
74+
fn intersection_of(lhs: &ImplDatum, rhs: &ImplDatum) -> InEnvironment<Goal> {
7575
fn params(impl_datum: &ImplDatum) -> &[Parameter] {
7676
&impl_datum.binders.value.trait_ref.parameters
7777
}
@@ -108,8 +108,5 @@ fn intersection_of(lhs: &ImplDatum, rhs: &ImplDatum) -> Canonical<InEnvironment<
108108
.expect("Every trait takes at least one input type")
109109
.quantify(QuantifierKind::Exists, binders);
110110

111-
Canonical {
112-
value: InEnvironment::empty(goal),
113-
binders: vec![],
114-
}
111+
InEnvironment::empty(goal)
115112
}

0 commit comments

Comments
 (0)