]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_trait_selection/src/traits/fulfill.rs
Cleanup
[rust.git] / compiler / rustc_trait_selection / src / traits / fulfill.rs
index a04f816b0f8a002bdc1c063a25748852fdd48c68..86c5209354c8577e1a3c6bed0dca0e7d2a1d82de 100644 (file)
@@ -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")
                 }
-            },
+            }
         }
     }