1 /// This declares a list of types which can be allocated by `Arena`.
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.
8 /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
9 /// listed. These impls will appear in the implement_ty_decoder! macro.
11 macro_rules! arena_types {
12 ($macro:path, $args:tt, $tcx:lifetime) => (
14 [] layouts: rustc_target::abi::Layout,
15 // AdtDef are interned and compared by address
16 [] adt_def: rustc_middle::ty::AdtDef,
17 [] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<$tcx>>,
18 [decode] mir: rustc_middle::mir::Body<$tcx>,
20 rustc_data_structures::steal::Steal<
21 rustc_index::vec::IndexVec<
22 rustc_middle::mir::Promoted,
23 rustc_middle::mir::Body<$tcx>
27 rustc_index::vec::IndexVec<
28 rustc_middle::mir::Promoted,
29 rustc_middle::mir::Body<$tcx>
31 [decode] typeck_results: rustc_middle::ty::TypeckResults<$tcx>,
32 [decode] borrowck_result:
33 rustc_middle::mir::BorrowCheckResult<$tcx>,
34 [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
35 [] const_allocs: rustc_middle::mir::interpret::Allocation,
36 // Required for the incremental on-disk cache
37 [few] mir_keys: rustc_hir::def_id::DefIdSet,
38 [] region_scope_tree: rustc_middle::middle::region::ScopeTree,
40 rustc_middle::infer::canonical::Canonical<'tcx,
41 rustc_middle::infer::canonical::QueryResponse<'tcx,
42 rustc_middle::traits::query::DropckOutlivesResult<'tcx>
45 [] normalize_projection_ty:
46 rustc_middle::infer::canonical::Canonical<'tcx,
47 rustc_middle::infer::canonical::QueryResponse<'tcx,
48 rustc_middle::traits::query::NormalizationResult<'tcx>
51 [] implied_outlives_bounds:
52 rustc_middle::infer::canonical::Canonical<'tcx,
53 rustc_middle::infer::canonical::QueryResponse<'tcx,
54 Vec<rustc_middle::traits::query::OutlivesBound<'tcx>>
58 rustc_middle::infer::canonical::Canonical<'tcx,
59 rustc_middle::infer::canonical::QueryResponse<'tcx, ()>
61 [] type_op_normalize_poly_fn_sig:
62 rustc_middle::infer::canonical::Canonical<'tcx,
63 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::PolyFnSig<'tcx>>
65 [] type_op_normalize_fn_sig:
66 rustc_middle::infer::canonical::Canonical<'tcx,
67 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::FnSig<'tcx>>
69 [] type_op_normalize_predicate:
70 rustc_middle::infer::canonical::Canonical<'tcx,
71 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Predicate<'tcx>>
73 [] type_op_normalize_ty:
74 rustc_middle::infer::canonical::Canonical<'tcx,
75 rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>>
77 [few] all_traits: Vec<rustc_hir::def_id::DefId>,
78 [few] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels,
79 [few] foreign_module: rustc_middle::middle::cstore::ForeignModule,
80 [few] foreign_modules: Vec<rustc_middle::middle::cstore::ForeignModule>,
81 [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
82 [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
83 [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
84 [] attribute: rustc_ast::Attribute,
85 [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
86 [] hir_id_set: rustc_hir::HirIdSet,
89 [] tys: rustc_middle::ty::TyS<$tcx>,
90 [] predicates: rustc_middle::ty::PredicateInner<$tcx>,
93 [few] indexed_hir: rustc_middle::hir::map::IndexedHir<$tcx>,
94 [few] hir_definitions: rustc_hir::definitions::Definitions,
95 [] hir_owner: rustc_middle::hir::Owner<$tcx>,
96 [] hir_owner_nodes: rustc_middle::hir::OwnerNodes<$tcx>,
98 // Note that this deliberately duplicates items in the `rustc_hir::arena`,
99 // since we need to allocate this type on both the `rustc_hir` arena
100 // (during lowering) and the `librustc_middle` arena (for decoding MIR)
101 [decode] asm_template: rustc_ast::InlineAsmTemplatePiece,
103 // This is used to decode the &'tcx [Span] for InlineAsm's line_spans.
104 [decode] span: rustc_span::Span,
105 [decode] used_trait_imports: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>,
110 arena_types!(rustc_arena::declare_arena, [], 'tcx);