rustc_middle::ty::util

Function fold_list

Source
pub fn fold_list<'tcx, F, L, T>(
    list: L,
    folder: &mut F,
    intern: impl FnOnce(TyCtxt<'tcx>, &[T]) -> L,
) -> Result<L, F::Error>
where F: FallibleTypeFolder<TyCtxt<'tcx>>, L: AsRef<[T]>, T: TypeFoldable<TyCtxt<'tcx>> + PartialEq + Copy,
Expand description

Does the equivalent of

let v = self.iter().map(|p| p.fold_with(folder)).collect::<SmallVec<[_; 8]>>();
folder.tcx().intern_*(&v)