]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/arena.rs
Auto merge of #93854 - matthiaskrgr:rollup-bh2a85j, r=matthiaskrgr
[rust.git] / compiler / rustc_middle / src / arena.rs
1 /// This higher-order macro declares a list of types which can be allocated by `Arena`.
2 ///
3 /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
4 /// listed. These impls will appear in the implement_ty_decoder! macro.
5 #[macro_export]
6 macro_rules! arena_types {
7     ($macro:path) => (
8         $macro!([
9             [] layout: rustc_target::abi::Layout,
10             [] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
11             // AdtDef are interned and compared by address
12             [decode] adt_def: rustc_middle::ty::AdtDef,
13             [] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<'tcx>>,
14             [] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<'tcx>>,
15             [decode] mir: rustc_middle::mir::Body<'tcx>,
16             [] steal_promoted:
17                 rustc_data_structures::steal::Steal<
18                     rustc_index::vec::IndexVec<
19                         rustc_middle::mir::Promoted,
20                         rustc_middle::mir::Body<'tcx>
21                     >
22                 >,
23             [decode] promoted:
24                 rustc_index::vec::IndexVec<
25                     rustc_middle::mir::Promoted,
26                     rustc_middle::mir::Body<'tcx>
27                 >,
28             [decode] typeck_results: rustc_middle::ty::TypeckResults<'tcx>,
29             [decode] borrowck_result:
30                 rustc_middle::mir::BorrowCheckResult<'tcx>,
31             [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
32             [decode] code_region: rustc_middle::mir::coverage::CodeRegion,
33             [] const_allocs: rustc_middle::mir::interpret::Allocation,
34             // Required for the incremental on-disk cache
35             [] mir_keys: rustc_hir::def_id::DefIdSet,
36             [] region_scope_tree: rustc_middle::middle::region::ScopeTree,
37             [] dropck_outlives:
38                 rustc_middle::infer::canonical::Canonical<'tcx,
39                     rustc_middle::infer::canonical::QueryResponse<'tcx,
40                         rustc_middle::traits::query::DropckOutlivesResult<'tcx>
41                     >
42                 >,
43             [] normalize_projection_ty:
44                 rustc_middle::infer::canonical::Canonical<'tcx,
45                     rustc_middle::infer::canonical::QueryResponse<'tcx,
46                         rustc_middle::traits::query::NormalizationResult<'tcx>
47                     >
48                 >,
49             [] implied_outlives_bounds:
50                 rustc_middle::infer::canonical::Canonical<'tcx,
51                     rustc_middle::infer::canonical::QueryResponse<'tcx,
52                         Vec<rustc_middle::traits::query::OutlivesBound<'tcx>>
53                     >
54                 >,
55             [] dtorck_constraint: rustc_middle::traits::query::DtorckConstraint<'tcx>,
56             [] candidate_step: rustc_middle::traits::query::CandidateStep<'tcx>,
57             [] autoderef_bad_ty: rustc_middle::traits::query::MethodAutoderefBadTy<'tcx>,
58             [] type_op_subtype:
59                 rustc_middle::infer::canonical::Canonical<'tcx,
60                     rustc_middle::infer::canonical::QueryResponse<'tcx, ()>
61                 >,
62             [] type_op_normalize_poly_fn_sig:
63                 rustc_middle::infer::canonical::Canonical<'tcx,
64                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::PolyFnSig<'tcx>>
65                 >,
66             [] type_op_normalize_fn_sig:
67                 rustc_middle::infer::canonical::Canonical<'tcx,
68                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::FnSig<'tcx>>
69                 >,
70             [] type_op_normalize_predicate:
71                 rustc_middle::infer::canonical::Canonical<'tcx,
72                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Predicate<'tcx>>
73                 >,
74             [] type_op_normalize_ty:
75                 rustc_middle::infer::canonical::Canonical<'tcx,
76                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>>
77                 >,
78             [] all_traits: Vec<rustc_hir::def_id::DefId>,
79             [] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels,
80             [] foreign_module: rustc_session::cstore::ForeignModule,
81             [] foreign_modules: Vec<rustc_session::cstore::ForeignModule>,
82             [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
83             [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
84             [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<'tcx>,
85             [] attribute: rustc_ast::Attribute,
86             [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
87             [] hir_id_set: rustc_hir::HirIdSet,
88
89             // Interned types
90             [] tys: rustc_middle::ty::TyS<'tcx>,
91             [] predicates: rustc_middle::ty::PredicateInner<'tcx>,
92
93             // Note that this deliberately duplicates items in the `rustc_hir::arena`,
94             // since we need to allocate this type on both the `rustc_hir` arena
95             // (during lowering) and the `librustc_middle` arena (for decoding MIR)
96             [decode] asm_template: rustc_ast::InlineAsmTemplatePiece,
97
98             // This is used to decode the &'tcx [Span] for InlineAsm's line_spans.
99             [decode] span: rustc_span::Span,
100             [decode] used_trait_imports: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>,
101             [decode] impl_source: rustc_middle::traits::ImplSource<'tcx, ()>,
102
103             [] dep_kind: rustc_middle::dep_graph::DepKindStruct,
104         ]);
105     )
106 }
107
108 arena_types!(rustc_arena::declare_arena);