about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorricked-twice <39213807+ricked-twice@users.noreply.github.com>2022-05-03 21:16:03 +0200
committerricked-twice <39213807+ricked-twice@users.noreply.github.com>2022-05-03 21:16:03 +0200
commitbfcd191905ce48c5b746af12c2995ef535d61b83 (patch)
tree7896c4988322dcf4600e42c27482823f19c4362f /compiler/rustc_trait_selection/src
parente1df625306f4136949e02612406f0c60df6008f3 (diff)
downloadrust-bfcd191905ce48c5b746af12c2995ef535d61b83.tar.gz
rust-bfcd191905ce48c5b746af12c2995ef535d61b83.zip
Quick fix for #96223.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs8
1 files changed, 7 insertions, 1 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 a3d3c7c0cf3..fcf188228dc 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -866,7 +866,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
                 return false;
             }
 
-            let orig_ty = old_pred.self_ty().skip_binder();
+            // This is a quick fix to resolve an ICE ([issue#96223](https://github.com/rust-lang/rust/issues/96223)).
+            // This change should probably be deeper.
+            // As suggested by @jackh726, `mk_trait_obligation_with_new_self_ty` could take a `Binder<(TraitRef, Ty)>
+            // instead of `Binder<Ty>` leading to some changes to its call places.
+            let Some(orig_ty) = old_pred.self_ty().no_bound_vars() else {
+                return false;
+            };
             let mk_result = |new_ty| {
                 let obligation =
                     self.mk_trait_obligation_with_new_self_ty(param_env, old_pred, new_ty);