]>
Commit | Line | Data |
---|---|---|
ba9703b0 XL |
1 | //! `TypeFoldable` implementations for MIR types |
2 | ||
f2b60f7d FG |
3 | use rustc_ast::InlineAsmTemplatePiece; |
4 | ||
ba9703b0 XL |
5 | use super::*; |
6 | use crate::ty; | |
7 | ||
064997fb | 8 | TrivialTypeTraversalAndLiftImpls! { |
ba9703b0 XL |
9 | BlockTailInfo, |
10 | MirPhase, | |
11 | SourceInfo, | |
12 | FakeReadCause, | |
13 | RetagKind, | |
14 | SourceScope, | |
ba9703b0 XL |
15 | SourceScopeLocalData, |
16 | UserTypeAnnotationIndex, | |
f2b60f7d FG |
17 | BorrowKind, |
18 | CastKind, | |
f2b60f7d FG |
19 | hir::Movability, |
20 | BasicBlock, | |
21 | SwitchTargets, | |
22 | GeneratorKind, | |
23 | GeneratorSavedLocal, | |
ba9703b0 XL |
24 | } |
25 | ||
2b03887a | 26 | TrivialTypeTraversalImpls! { |
49aad941 FG |
27 | ConstValue<'tcx>, |
28 | NullOp<'tcx>, | |
2b03887a FG |
29 | } |
30 | ||
9ffffee4 FG |
31 | impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [InlineAsmTemplatePiece] { |
32 | fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>( | |
33 | self, | |
34 | _folder: &mut F, | |
35 | ) -> Result<Self, F::Error> { | |
a2a8927a | 36 | Ok(self) |
ba9703b0 | 37 | } |
ba9703b0 XL |
38 | } |
39 | ||
9ffffee4 FG |
40 | impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [Span] { |
41 | fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>( | |
42 | self, | |
43 | _folder: &mut F, | |
44 | ) -> Result<Self, F::Error> { | |
f2b60f7d | 45 | Ok(self) |
ba9703b0 | 46 | } |
ba9703b0 XL |
47 | } |
48 | ||
9ffffee4 FG |
49 | impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<PlaceElem<'tcx>> { |
50 | fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>( | |
51 | self, | |
52 | folder: &mut F, | |
53 | ) -> Result<Self, F::Error> { | |
54 | ty::util::fold_list(self, folder, |tcx, v| tcx.mk_place_elems(v)) | |
ba9703b0 | 55 | } |
ba9703b0 | 56 | } |