1 //! `TypeFoldable` implementations for MIR types
3 use rustc_ast::InlineAsmTemplatePiece;
8 TrivialTypeTraversalAndLiftImpls! {
16 UserTypeAnnotationIndex,
29 impl<'tcx> TypeFoldable<'tcx> for &'tcx [InlineAsmTemplatePiece] {
30 fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
35 impl<'tcx> TypeFoldable<'tcx> for &'tcx [Span] {
36 fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
41 impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<PlaceElem<'tcx>> {
42 fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
43 ty::util::fold_list(self, folder, |tcx, v| tcx.intern_place_elems(v))
47 impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
48 fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
53 impl<'tcx> TypeFoldable<'tcx> for ConstantKind<'tcx> {
55 fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
56 folder.try_fold_mir_const(self)
60 impl<'tcx> TypeSuperFoldable<'tcx> for ConstantKind<'tcx> {
61 fn try_super_fold_with<F: FallibleTypeFolder<'tcx>>(
64 ) -> Result<Self, F::Error> {
66 ConstantKind::Ty(c) => Ok(ConstantKind::Ty(c.try_fold_with(folder)?)),
67 ConstantKind::Val(v, t) => Ok(ConstantKind::Val(v, t.try_fold_with(folder)?)),