Avoid unnecessary renumbering

This commit is contained in:
Jonáš Fiala 2023-10-16 14:29:36 +02:00
parent 9ace9da2e0
commit 2bba98b121

View File

@ -81,6 +81,10 @@ impl<'a, 'tcx> MutVisitor<'tcx> for RegionRenumberer<'a, 'tcx> {
#[instrument(skip(self), level = "debug")] #[instrument(skip(self), level = "debug")]
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) { fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) {
if matches!(ty_context, TyContext::ReturnTy(_)) {
// We will renumber the return ty when called again with `TyContext::LocalDecl`
return;
}
*ty = self.renumber_regions(*ty, || RegionCtxt::TyContext(ty_context)); *ty = self.renumber_regions(*ty, || RegionCtxt::TyContext(ty_context));
debug!(?ty); debug!(?ty);