Skip to content

Commit

Permalink
fold substs
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Feb 4, 2022
1 parent 4e8fb74 commit 711e736
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 711e736

Please sign in to comment.