Skip to content

Commit

Permalink
Auto merge of #93643 - lcnr:fold-substs-perf, r=michaelwoerister
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors committed Feb 7, 2022
2 parents 25b21a1 + 711e736 commit 926e784
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions compiler/rustc_middle/src/ty/subst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&params))
}
}
_ => ty::util::fold_list(self, folder, |tcx, v| tcx.intern_substs(v)),
}
}

Expand Down

0 comments on commit 926e784

Please sign in to comment.