]> git.lizzy.rs Git - rust.git/commitdiff
fix elaborate for predicates with unbound variables
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Fri, 19 Jun 2020 17:19:21 +0000 (19:19 +0200)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Mon, 27 Jul 2020 19:06:36 +0000 (21:06 +0200)
src/librustc_infer/traits/util.rs
src/librustc_trait_selection/traits/auto_trait.rs

index 1bee16f7556a18bca771c15ca01c8839c112e1c6..6aeb225a6e9cbf7a789274bf6d495b6367dac3dc 100644 (file)
@@ -151,15 +151,11 @@ pub fn filter_to_traits(self) -> FilterToTraits<'tcx, Self> {
 
     fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
         let tcx = self.visited.tcx;
-        let pred = match obligation.predicate.kind() {
-            // We have to be careful and rebind this when
-            // dealing with a predicate further down.
-            ty::PredicateKind::ForAll(binder) => binder.skip_binder().kind(),
-            pred => pred,
-        };
-
-        match pred {
-            ty::PredicateKind::ForAll(_) => bug!("unexpected predicate: {:?}", pred),
+
+        match obligation.predicate.ignore_qualifiers(tcx).skip_binder().kind() {
+            ty::PredicateKind::ForAll(_) => {
+                bug!("unexpected predicate: {:?}", obligation.predicate)
+            }
             ty::PredicateKind::Trait(data, _) => {
                 // Get predicates declared on the trait.
                 let predicates = tcx.super_predicates_of(data.def_id());
index 9c530912bf0e4ed88a7d8b68cb3564b2f6550ec1..74a4939ae10d5cf4c9d45d2fde20257be82ccf16 100644 (file)
@@ -763,7 +763,7 @@ fn evaluate_nested_obligations(
                             }
                         }
                         Ok(None) => {
-                            // It's ok not to make progress when hvave no inference variables -
+                            // It's ok not to make progress when have no inference variables -
                             // in that case, we were only performing unifcation to check if an
                             // error occurred (which would indicate that it's impossible for our
                             // type to implement the auto trait).