Erase **all** regions when probing for associated types in astconv

This commit is contained in:
Michael Goulet 2023-02-28 17:29:40 +00:00
parent 31f858d9a5
commit cb9852b8e6
3 changed files with 21 additions and 2 deletions

View file

@ -2403,8 +2403,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
infcx
.can_eq(
ty::ParamEnv::empty(),
tcx.erase_regions(impl_.self_ty()),
tcx.erase_regions(qself_ty),
impl_.self_ty(),
// Must fold past escaping bound vars too,
// since we have those at this point in astconv.
tcx.fold_regions(qself_ty, |_, _| tcx.lifetimes.re_erased),
)
})
&& tcx.impl_polarity(impl_def_id) != ty::ImplPolarity::Negative