]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_middle/src/mir/type_foldable.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / compiler / rustc_middle / src / mir / type_foldable.rs
CommitLineData
ba9703b0
XL
1//! `TypeFoldable` implementations for MIR types
2
f2b60f7d
FG
3use rustc_ast::InlineAsmTemplatePiece;
4
ba9703b0
XL
5use super::*;
6use crate::ty;
7
064997fb 8TrivialTypeTraversalAndLiftImpls! {
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 19 NullOp,
f2b60f7d
FG
20 hir::Movability,
21 BasicBlock,
22 SwitchTargets,
23 GeneratorKind,
24 GeneratorSavedLocal,
ba9703b0
XL
25}
26
2b03887a
FG
27TrivialTypeTraversalImpls! {
28 for <'tcx> {
29 ConstValue<'tcx>,
30 }
31}
32
9ffffee4
FG
33impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [InlineAsmTemplatePiece] {
34 fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
35 self,
36 _folder: &mut F,
37 ) -> Result<Self, F::Error> {
a2a8927a 38 Ok(self)
ba9703b0 39 }
ba9703b0
XL
40}
41
9ffffee4
FG
42impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [Span] {
43 fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
44 self,
45 _folder: &mut F,
46 ) -> Result<Self, F::Error> {
f2b60f7d 47 Ok(self)
ba9703b0 48 }
ba9703b0
XL
49}
50
9ffffee4
FG
51impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<PlaceElem<'tcx>> {
52 fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
53 self,
54 folder: &mut F,
55 ) -> Result<Self, F::Error> {
56 ty::util::fold_list(self, folder, |tcx, v| tcx.mk_place_elems(v))
ba9703b0 57 }
ba9703b0 58}