mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Auto merge of #93643 - lcnr:fold-substs-perf, r=michaelwoerister
use `fold_list` in `try_super_fold_with` for `SubstsRef` split out from #93505 as this by itself is responsible for most of the perf improvements there r? `@michaelwoerister`
This commit is contained in:
commit
926e7843ea
@ -396,15 +396,7 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> {
|
||||
}
|
||||
}
|
||||
0 => Ok(self),
|
||||
_ => {
|
||||
let params: SmallVec<[_; 8]> =
|
||||
self.iter().map(|k| k.try_fold_with(folder)).collect::<Result<_, _>>()?;
|
||||
if params[..] == self[..] {
|
||||
Ok(self)
|
||||
} else {
|
||||
Ok(folder.tcx().intern_substs(¶ms))
|
||||
}
|
||||
}
|
||||
_ => ty::util::fold_list(self, folder, |tcx, v| tcx.intern_substs(v)),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user