]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_middle/src/arena.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / compiler / rustc_middle / src / arena.rs
CommitLineData
ba9703b0
XL
1/// This declares a list of types which can be allocated by `Arena`.
2///
3/// The `few` modifier will cause allocation to use the shared arena and recording the destructor.
4/// This is faster and more memory efficient if there's only a few allocations of the type.
5/// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is
6/// faster and more memory efficient if there is lots of allocations.
7///
f9f354fc 8/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
ba9703b0
XL
9/// listed. These impls will appear in the implement_ty_decoder! macro.
10#[macro_export]
11macro_rules! arena_types {
94222f64
XL
12 ($macro:path, $tcx:lifetime) => (
13 $macro!([
3dfed10e 14 [] layouts: rustc_target::abi::Layout,
f9f354fc 15 // AdtDef are interned and compared by address
3dfed10e 16 [] adt_def: rustc_middle::ty::AdtDef,
17df50a5 17 [] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<$tcx>>,
fc512014 18 [] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<$tcx>>,
3dfed10e
XL
19 [decode] mir: rustc_middle::mir::Body<$tcx>,
20 [] steal_promoted:
fc512014 21 rustc_data_structures::steal::Steal<
3dfed10e
XL
22 rustc_index::vec::IndexVec<
23 rustc_middle::mir::Promoted,
24 rustc_middle::mir::Body<$tcx>
25 >
26 >,
27 [decode] promoted:
28 rustc_index::vec::IndexVec<
29 rustc_middle::mir::Promoted,
30 rustc_middle::mir::Body<$tcx>
31 >,
32 [decode] typeck_results: rustc_middle::ty::TypeckResults<$tcx>,
33 [decode] borrowck_result:
34 rustc_middle::mir::BorrowCheckResult<$tcx>,
35 [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
fc512014 36 [decode] code_region: rustc_middle::mir::coverage::CodeRegion,
3dfed10e 37 [] const_allocs: rustc_middle::mir::interpret::Allocation,
f9f354fc 38 // Required for the incremental on-disk cache
3dfed10e
XL
39 [few] mir_keys: rustc_hir::def_id::DefIdSet,
40 [] region_scope_tree: rustc_middle::middle::region::ScopeTree,
ba9703b0
XL
41 [] dropck_outlives:
42 rustc_middle::infer::canonical::Canonical<'tcx,
43 rustc_middle::infer::canonical::QueryResponse<'tcx,
44 rustc_middle::traits::query::DropckOutlivesResult<'tcx>
45 >
46 >,
47 [] normalize_projection_ty:
48 rustc_middle::infer::canonical::Canonical<'tcx,
49 rustc_middle::infer::canonical::QueryResponse<'tcx,
50 rustc_middle::traits::query::NormalizationResult<'tcx>
51 >
52 >,
53 [] implied_outlives_bounds:
54 rustc_middle::infer::canonical::Canonical<'tcx,
55 rustc_middle::infer::canonical::QueryResponse<'tcx,
56 Vec<rustc_middle::traits::query::OutlivesBound<'tcx>>
57 >
58 >,
59 [] type_op_subtype:
60 rustc_middle::infer::canonical::Canonical<'tcx,
61 rustc_middle::infer::canonical::QueryResponse<'tcx, ()>
62 >,
63 [] type_op_normalize_poly_fn_sig:
64 rustc_middle::infer::canonical::Canonical<'tcx,
65 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::PolyFnSig<'tcx>>
66 >,
67 [] type_op_normalize_fn_sig:
68 rustc_middle::infer::canonical::Canonical<'tcx,
69 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::FnSig<'tcx>>
70 >,
71 [] type_op_normalize_predicate:
72 rustc_middle::infer::canonical::Canonical<'tcx,
73 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Predicate<'tcx>>
74 >,
75 [] type_op_normalize_ty:
76 rustc_middle::infer::canonical::Canonical<'tcx,
77 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>>
78 >,
3dfed10e
XL
79 [few] all_traits: Vec<rustc_hir::def_id::DefId>,
80 [few] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels,
81 [few] foreign_module: rustc_middle::middle::cstore::ForeignModule,
82 [few] foreign_modules: Vec<rustc_middle::middle::cstore::ForeignModule>,
83 [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
84 [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
85 [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
86 [] attribute: rustc_ast::Attribute,
87 [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
88 [] hir_id_set: rustc_hir::HirIdSet,
ba9703b0
XL
89
90 // Interned types
3dfed10e
XL
91 [] tys: rustc_middle::ty::TyS<$tcx>,
92 [] predicates: rustc_middle::ty::PredicateInner<$tcx>,
ba9703b0
XL
93
94 // HIR query types
17df50a5 95 [few] indexed_hir: rustc_middle::hir::IndexedHir<$tcx>,
3dfed10e
XL
96 [few] hir_definitions: rustc_hir::definitions::Definitions,
97 [] hir_owner: rustc_middle::hir::Owner<$tcx>,
98 [] hir_owner_nodes: rustc_middle::hir::OwnerNodes<$tcx>,
f9f354fc
XL
99
100 // Note that this deliberately duplicates items in the `rustc_hir::arena`,
101 // since we need to allocate this type on both the `rustc_hir` arena
102 // (during lowering) and the `librustc_middle` arena (for decoding MIR)
3dfed10e 103 [decode] asm_template: rustc_ast::InlineAsmTemplatePiece,
f9f354fc
XL
104
105 // This is used to decode the &'tcx [Span] for InlineAsm's line_spans.
3dfed10e
XL
106 [decode] span: rustc_span::Span,
107 [decode] used_trait_imports: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>,
ba9703b0
XL
108 ], $tcx);
109 )
110}
111
94222f64 112arena_types!(rustc_arena::declare_arena, 'tcx);