1
Fork 0

bail out early when substituting mir constants that don't need substituting

This commit is contained in:
Oli Scherer 2021-03-31 09:13:25 +00:00
parent 4e8edfb5c2
commit d139968d19

View file

@ -506,6 +506,9 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
}
fn fold_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> mir::ConstantKind<'tcx> {
if !c.needs_subst() {
return c;
}
c.super_fold_with(self)
}
}