Skip to content

Commit

Permalink
Avoid unnecessary renumbering
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Oct 16, 2023
1 parent 9ace9da commit 2bba98b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_borrowck/src/renumber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ impl<'a, 'tcx> MutVisitor<'tcx> for RegionRenumberer<'a, 'tcx> {

#[instrument(skip(self), level = "debug")]
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));

debug!(?ty);
Expand Down

0 comments on commit 2bba98b

Please sign in to comment.