diff options
| author | bors <bors@rust-lang.org> | 2022-02-07 03:47:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-07 03:47:47 +0000 |
| commit | 926e7843eaa1794f15948395588eddedfb74a0d8 (patch) | |
| tree | 2f4503e86885482803197033656e5e3695c6dc0d | |
| parent | 25b21a1d160013b2d58c98d0337c75a721317160 (diff) | |
| parent | 711e736262a5ef0c738a8bdfba55501bcfbe19a2 (diff) | |
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`
| -rw-r--r-- | compiler/rustc_middle/src/ty/subst.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs index cf97344f18e..c723df83905 100644 --- a/compiler/rustc_middle/src/ty/subst.rs +++ b/compiler/rustc_middle/src/ty/subst.rs @@ -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)), } } |
