about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-24 17:47:08 +0200
committerGitHub <noreply@github.com>2023-07-24 17:47:08 +0200
commit15c723433f2bc91a54fca0703975797bf97f474c (patch)
treea31f33d4ae81b5cb5ddb58903c21cd42fec8bd31 /compiler/rustc_trait_selection/src
parent60a5d2dbde2eba50033d7b5e2f9a99616b132174 (diff)
parentd1380a18447e9509cc9cd5307edcb4e22ca0351b (diff)
downloadrust-15c723433f2bc91a54fca0703975797bf97f474c.tar.gz
rust-15c723433f2bc91a54fca0703975797bf97f474c.zip
Rollup merge of #113985 - compiler-errors:issue-113951, r=estebank
Use erased self type when autoderefing for trait error suggestion

Let's not try to pass something from `skip_binder` into autoderef.

Fixes #113951
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs10
1 files changed, 3 insertions, 7 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 9c51de1814b..220b3576ddb 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -777,18 +777,14 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
                 real_trait_pred = parent_trait_pred;
             }
 
-            let real_ty = real_trait_pred.self_ty();
             // We `erase_late_bound_regions` here because `make_subregion` does not handle
             // `ReLateBound`, and we don't particularly care about the regions.
-            if !self.can_eq(
-                obligation.param_env,
-                self.tcx.erase_late_bound_regions(real_ty),
-                arg_ty,
-            ) {
+            let real_ty = self.tcx.erase_late_bound_regions(real_trait_pred.self_ty());
+            if !self.can_eq(obligation.param_env, real_ty, arg_ty) {
                 continue;
             }
 
-            if let ty::Ref(region, base_ty, mutbl) = *real_ty.skip_binder().kind() {
+            if let ty::Ref(region, base_ty, mutbl) = *real_ty.kind() {
                 let autoderef = (self.autoderef_steps)(base_ty);
                 if let Some(steps) =
                     autoderef.into_iter().enumerate().find_map(|(steps, (ty, obligations))| {