1
Fork 0

Quick fix for #96223.

This commit is contained in:
ricked-twice 2022-05-03 21:16:03 +02:00
parent e1df625306
commit bfcd191905
No known key found for this signature in database
GPG key ID: 92AB9553ED577503
3 changed files with 88 additions and 1 deletions

View file

@ -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);