Skip to content

Commit 2bba98b

Browse files
committed
Avoid unnecessary renumbering
1 parent 9ace9da commit 2bba98b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: compiler/rustc_borrowck/src/renumber.rs

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ impl<'a, 'tcx> MutVisitor<'tcx> for RegionRenumberer<'a, 'tcx> {
8181

8282
#[instrument(skip(self), level = "debug")]
8383
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) {
84+
if matches!(ty_context, TyContext::ReturnTy(_)) {
85+
// We will renumber the return ty when called again with `TyContext::LocalDecl`
86+
return;
87+
}
8488
*ty = self.renumber_regions(*ty, || RegionCtxt::TyContext(ty_context));
8589

8690
debug!(?ty);

0 commit comments

Comments
 (0)