Skip to content

Commit d139968

Browse files
committed
bail out early when substituting mir constants that don't need substituting
1 parent 4e8edfb commit d139968

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_middle/src/ty/subst.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
506506
}
507507

508508
fn fold_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> mir::ConstantKind<'tcx> {
509+
if !c.needs_subst() {
510+
return c;
511+
}
509512
c.super_fold_with(self)
510513
}
511514
}

0 commit comments

Comments
 (0)