Auto merge of #37129 - arielb1:erased-normal, r=eddyb
normalize types every time HR regions are erased Associated type normalization is inhibited by higher-ranked regions. Therefore, every time we erase them, we must re-normalize. I was meaning to introduce this change some time ago, but we used to erase regions in generic context, which broke this terribly (because you can't always normalize in a generic context). That seems to be gone now. Ensure this by having a `erase_late_bound_regions_and_normalize` function. Fixes #37109 (the missing call was in mir::block). r? @eddyb
This commit is contained in:
commit
6572a46311
13 changed files with 38 additions and 38 deletions
|
|
@ -583,7 +583,8 @@ impl_trans_normalize!('gcx,
|
|||
ty::FnSig<'gcx>,
|
||||
&'gcx ty::BareFnTy<'gcx>,
|
||||
ty::ClosureSubsts<'gcx>,
|
||||
ty::PolyTraitRef<'gcx>
|
||||
ty::PolyTraitRef<'gcx>,
|
||||
ty::ExistentialTraitRef<'gcx>
|
||||
);
|
||||
|
||||
impl<'gcx> TransNormalize<'gcx> for LvalueTy<'gcx> {
|
||||
|
|
@ -603,6 +604,18 @@ impl<'gcx> TransNormalize<'gcx> for LvalueTy<'gcx> {
|
|||
|
||||
// NOTE: Callable from trans only!
|
||||
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
|
||||
/// Currently, higher-ranked type bounds inhibit normalization. Therefore,
|
||||
/// each time we erase them in translation, we need to normalize
|
||||
/// the contents.
|
||||
pub fn erase_late_bound_regions_and_normalize<T>(self, value: &ty::Binder<T>)
|
||||
-> T
|
||||
where T: TransNormalize<'tcx>
|
||||
{
|
||||
assert!(!value.needs_subst());
|
||||
let value = self.erase_late_bound_regions(value);
|
||||
self.normalize_associated_type(&value)
|
||||
}
|
||||
|
||||
pub fn normalize_associated_type<T>(self, value: &T) -> T
|
||||
where T: TransNormalize<'tcx>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue