]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/mir/type_foldable.rs
Auto merge of #106976 - tmiasko:borrowck-lazy-dominators, r=cjgillot
[rust.git] / compiler / rustc_middle / src / mir / type_foldable.rs
1 //! `TypeFoldable` implementations for MIR types
2
3 use rustc_ast::InlineAsmTemplatePiece;
4
5 use super::*;
6 use crate::ty;
7
8 TrivialTypeTraversalAndLiftImpls! {
9     BlockTailInfo,
10     MirPhase,
11     SourceInfo,
12     FakeReadCause,
13     RetagKind,
14     SourceScope,
15     SourceScopeLocalData,
16     UserTypeAnnotationIndex,
17     BorrowKind,
18     CastKind,
19     NullOp,
20     hir::Movability,
21     BasicBlock,
22     SwitchTargets,
23     GeneratorKind,
24     GeneratorSavedLocal,
25 }
26
27 TrivialTypeTraversalImpls! {
28     for <'tcx> {
29         ConstValue<'tcx>,
30     }
31 }
32
33 impl<'tcx> TypeFoldable<'tcx> for &'tcx [InlineAsmTemplatePiece] {
34     fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
35         Ok(self)
36     }
37 }
38
39 impl<'tcx> TypeFoldable<'tcx> for &'tcx [Span] {
40     fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
41         Ok(self)
42     }
43 }
44
45 impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<PlaceElem<'tcx>> {
46     fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
47         ty::util::fold_list(self, folder, |tcx, v| tcx.intern_place_elems(v))
48     }
49 }
50
51 impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
52     fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
53         Ok(self)
54     }
55 }