X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_trait_selection%2Fsrc%2Ftraits%2Ffulfill.rs;h=86c5209354c8577e1a3c6bed0dca0e7d2a1d82de;hb=e76476afe4179fb0c430cfcd86d061cc990a7bf7;hp=a04f816b0f8a002bdc1c063a25748852fdd48c68;hpb=43d13e2d584c32b125d61f055e6e7127a77b1d54;p=rust.git diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index a04f816b0f8..86c5209354c 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -345,8 +345,9 @@ fn progress_changed_obligations( let infcx = self.selcx.infcx(); - match *obligation.predicate.kind() { - ty::PredicateKind::ForAll(binder) => match binder.skip_binder() { + let binder = obligation.predicate.bound_atom(); + if binder.skip_binder().has_escaping_bound_vars() { + match binder.skip_binder() { // Evaluation will discard candidates using the leak check. // This means we need to pass it the bound version of our // predicate. @@ -383,8 +384,9 @@ fn progress_changed_obligations( ty::PredicateAtom::TypeWellFormedFromEnv(..) => { bug!("TypeWellFormedFromEnv is only used for Chalk") } - }, - ty::PredicateKind::Atom(atom) => match atom { + } + } else { + match binder.skip_binder() { ty::PredicateAtom::Trait(data, _) => { let trait_obligation = obligation.with(Binder::dummy(data)); @@ -596,7 +598,7 @@ fn progress_changed_obligations( ty::PredicateAtom::TypeWellFormedFromEnv(..) => { bug!("TypeWellFormedFromEnv is only used for Chalk") } - }, + } } }