From 711e736262a5ef0c738a8bdfba55501bcfbe19a2 Mon Sep 17 00:00:00 2001 From: lcnr Date: Fri, 4 Feb 2022 11:10:02 +0100 Subject: [PATCH] fold substs --- compiler/rustc_middle/src/ty/subst.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs index cf97344f18e76..c723df83905da 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::>()?; - if params[..] == self[..] { - Ok(self) - } else { - Ok(folder.tcx().intern_substs(¶ms)) - } - } + _ => ty::util::fold_list(self, folder, |tcx, v| tcx.intern_substs(v)), } }