about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2022-12-12 11:53:39 -0800
committerEsteban Küber <esteban@kuber.com.ar>2022-12-12 11:53:39 -0800
commitf4ed2d1cca0106eb4aec99b61670ecac378ca087 (patch)
treec479a86d5182e4d804249d844fea4ee45e5018c0
parent348386985d41852829c0785dd84e50c2780b7f78 (diff)
downloadrust-f4ed2d1cca0106eb4aec99b61670ecac378ca087.tar.gz
rust-f4ed2d1cca0106eb4aec99b61670ecac378ca087.zip
Do not `skip_binder`s
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index df470f62089..40c81025471 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -3133,18 +3133,21 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             if let ObligationCauseCode::ExprBindingObligation(def_id, _, _, idx) = parent_code.deref()
                 && let predicates = self.tcx.predicates_of(def_id).instantiate_identity(self.tcx)
                 && let Some(pred) = predicates.predicates.get(*idx)
-                && let ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) = pred.kind().skip_binder()
+                && let Ok(trait_pred) = pred.kind().try_map_bound(|pred| match pred {
+                    ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => Ok(trait_pred),
+                    _ => Err(()),
+                })
             {
                 let mut c = CollectAllMismatches {
                     infcx: self.infcx,
                     param_env,
                     errors: vec![],
                 };
-                if let ty::PredicateKind::Clause(ty::Clause::Trait(
-                        predicate
-                    )) = predicate.kind().skip_binder()
-                {
-                    if let Ok(_) = c.relate(trait_pred, predicate) {
+                if let Ok(trait_predicate) = predicate.kind().try_map_bound(|pred| match pred {
+                    ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => Ok(trait_pred),
+                    _ => Err(()),
+                }) {
+                    if let Ok(_) = c.relate(trait_pred, trait_predicate) {
                         type_diffs = c.errors;
                     }
                 }