about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-06-19 19:19:21 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-07-27 21:06:36 +0200
commitbbd581c583a7168359bf94beaa111d6ad3316837 (patch)
tree778a7fe7ae10a4814f49e7113703d30ec027a8f8
parent8d4c99ad88169689ce560ad05eedf60de1d5e9c4 (diff)
downloadrust-bbd581c583a7168359bf94beaa111d6ad3316837.tar.gz
rust-bbd581c583a7168359bf94beaa111d6ad3316837.zip
fix elaborate for predicates with unbound variables
-rw-r--r--src/librustc_infer/traits/util.rs14
-rw-r--r--src/librustc_trait_selection/traits/auto_trait.rs2
2 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc_infer/traits/util.rs b/src/librustc_infer/traits/util.rs
index 1bee16f7556..6aeb225a6e9 100644
--- a/src/librustc_infer/traits/util.rs
+++ b/src/librustc_infer/traits/util.rs
@@ -151,15 +151,11 @@ impl Elaborator<'tcx> {
 
     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());
diff --git a/src/librustc_trait_selection/traits/auto_trait.rs b/src/librustc_trait_selection/traits/auto_trait.rs
index 9c530912bf0..74a4939ae10 100644
--- a/src/librustc_trait_selection/traits/auto_trait.rs
+++ b/src/librustc_trait_selection/traits/auto_trait.rs
@@ -763,7 +763,7 @@ impl AutoTraitFinder<'tcx> {
                             }
                         }
                         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).