diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-30 11:26:50 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-30 11:26:50 +0530 |
| commit | 1ea84961e81de8e0eebbb8353d7867a039ffa70f (patch) | |
| tree | 391ce008029f9f70ed494067a781a1e6bb69cd1e /compiler/rustc_trait_selection | |
| parent | aa9bfdee322889eb6f419d3817d3d87060e91581 (diff) | |
| parent | 48b3d8aa829a5ac3ff317e18ff025ac75a7c9665 (diff) | |
| download | rust-1ea84961e81de8e0eebbb8353d7867a039ffa70f.tar.gz rust-1ea84961e81de8e0eebbb8353d7867a039ffa70f.zip | |
Rollup merge of #101022 - compiler-errors:issue-101020, r=jackh726
Erase late bound regions before comparing types in `suggest_dereferences` Fixes #101020
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 12 |
1 files changed, 8 insertions, 4 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 a93f9ec0397..54f01577c5e 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -690,13 +690,17 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { real_trait_pred = parent_trait_pred; } - // Skipping binder here, remapping below - let real_ty = real_trait_pred.self_ty().skip_binder(); - if self.can_eq(obligation.param_env, real_ty, arg_ty).is_err() { + 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) + .is_err() + { continue; } - if let ty::Ref(region, base_ty, mutbl) = *real_ty.kind() { + if let ty::Ref(region, base_ty, mutbl) = *real_ty.skip_binder().kind() { let mut autoderef = Autoderef::new( self, obligation.param_env, |
