Skip to content

Commit 926e784

Browse files
committed
Auto merge of rust-lang#93643 - lcnr:fold-substs-perf, r=michaelwoerister
use `fold_list` in `try_super_fold_with` for `SubstsRef` split out from rust-lang#93505 as this by itself is responsible for most of the perf improvements there r? `@michaelwoerister`
2 parents 25b21a1 + 711e736 commit 926e784

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

compiler/rustc_middle/src/ty/subst.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,7 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> {
396396
}
397397
}
398398
0 => Ok(self),
399-
_ => {
400-
let params: SmallVec<[_; 8]> =
401-
self.iter().map(|k| k.try_fold_with(folder)).collect::<Result<_, _>>()?;
402-
if params[..] == self[..] {
403-
Ok(self)
404-
} else {
405-
Ok(folder.tcx().intern_substs(&params))
406-
}
407-
}
399+
_ => ty::util::fold_list(self, folder, |tcx, v| tcx.intern_substs(v)),
408400
}
409401
}
410402

0 commit comments

Comments
 (0)