Visit type in process_projection_elem.

This commit is contained in:
Camille GILLOT 2021-10-16 14:03:30 +02:00
parent 6d246f0c8d
commit 29b30a9bd2
4 changed files with 6 additions and 60 deletions

View file

@ -35,24 +35,4 @@ impl<'tcx> MutVisitor<'tcx> for RevealAllVisitor<'tcx> {
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _: TyContext) {
*ty = self.tcx.normalize_erasing_regions(self.param_env, ty);
}
#[inline]
fn process_projection_elem(
&mut self,
elem: PlaceElem<'tcx>,
_: Location,
) -> Option<PlaceElem<'tcx>> {
match elem {
PlaceElem::Field(field, ty) => {
let new_ty = self.tcx.normalize_erasing_regions(self.param_env, ty);
if ty != new_ty { Some(PlaceElem::Field(field, new_ty)) } else { None }
}
// None of those contain a Ty.
PlaceElem::Index(..)
| PlaceElem::Deref
| PlaceElem::ConstantIndex { .. }
| PlaceElem::Subslice { .. }
| PlaceElem::Downcast(..) => None,
}
}
}