]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/arena.rs
Rollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviper
[rust.git] / compiler / rustc_middle / src / arena.rs
1 #![allow(rustc::usage_of_ty_tykind)]
2
3 /// This higher-order macro declares a list of types which can be allocated by `Arena`.
4 ///
5 /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
6 /// listed. These impls will appear in the implement_ty_decoder! macro.
7 #[macro_export]
8 macro_rules! arena_types {
9     ($macro:path) => (
10         $macro!([
11             [] layout: rustc_target::abi::LayoutS<rustc_target::abi::VariantIdx>,
12             [] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
13             // AdtDef are interned and compared by address
14             [decode] adt_def: rustc_middle::ty::AdtDefData,
15             [] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<'tcx>>,
16             [] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<'tcx>>,
17             [decode] mir: rustc_middle::mir::Body<'tcx>,
18             [] steal_promoted:
19                 rustc_data_structures::steal::Steal<
20                     rustc_index::vec::IndexVec<
21                         rustc_middle::mir::Promoted,
22                         rustc_middle::mir::Body<'tcx>
23                     >
24                 >,
25             [decode] promoted:
26                 rustc_index::vec::IndexVec<
27                     rustc_middle::mir::Promoted,
28                     rustc_middle::mir::Body<'tcx>
29                 >,
30             [decode] typeck_results: rustc_middle::ty::TypeckResults<'tcx>,
31             [decode] borrowck_result:
32                 rustc_middle::mir::BorrowCheckResult<'tcx>,
33             [] resolver: rustc_data_structures::steal::Steal<rustc_middle::ty::ResolverAstLowering>,
34             [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
35             [decode] code_region: rustc_middle::mir::coverage::CodeRegion,
36             [] const_allocs: rustc_middle::mir::interpret::Allocation,
37             [] region_scope_tree: rustc_middle::middle::region::ScopeTree,
38             // Required for the incremental on-disk cache
39             [] mir_keys: rustc_hir::def_id::DefIdSet,
40             [] dropck_outlives:
41                 rustc_middle::infer::canonical::Canonical<'tcx,
42                     rustc_middle::infer::canonical::QueryResponse<'tcx,
43                         rustc_middle::traits::query::DropckOutlivesResult<'tcx>
44                     >
45                 >,
46             [] normalize_projection_ty:
47                 rustc_middle::infer::canonical::Canonical<'tcx,
48                     rustc_middle::infer::canonical::QueryResponse<'tcx,
49                         rustc_middle::traits::query::NormalizationResult<'tcx>
50                     >
51                 >,
52             [] implied_outlives_bounds:
53                 rustc_middle::infer::canonical::Canonical<'tcx,
54                     rustc_middle::infer::canonical::QueryResponse<'tcx,
55                         Vec<rustc_middle::traits::query::OutlivesBound<'tcx>>
56                     >
57                 >,
58             [] dtorck_constraint: rustc_middle::traits::query::DropckConstraint<'tcx>,
59             [] candidate_step: rustc_middle::traits::query::CandidateStep<'tcx>,
60             [] autoderef_bad_ty: rustc_middle::traits::query::MethodAutoderefBadTy<'tcx>,
61             [] query_region_constraints: rustc_middle::infer::canonical::QueryRegionConstraints<'tcx>,
62             [] type_op_subtype:
63                 rustc_middle::infer::canonical::Canonical<'tcx,
64                     rustc_middle::infer::canonical::QueryResponse<'tcx, ()>
65                 >,
66             [] type_op_normalize_poly_fn_sig:
67                 rustc_middle::infer::canonical::Canonical<'tcx,
68                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::PolyFnSig<'tcx>>
69                 >,
70             [] type_op_normalize_fn_sig:
71                 rustc_middle::infer::canonical::Canonical<'tcx,
72                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::FnSig<'tcx>>
73                 >,
74             [] type_op_normalize_predicate:
75                 rustc_middle::infer::canonical::Canonical<'tcx,
76                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Predicate<'tcx>>
77                 >,
78             [] type_op_normalize_ty:
79                 rustc_middle::infer::canonical::Canonical<'tcx,
80                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>>
81                 >,
82             [] all_traits: Vec<rustc_hir::def_id::DefId>,
83             [] effective_visibilities: rustc_middle::middle::privacy::EffectiveVisibilities,
84             [] foreign_module: rustc_session::cstore::ForeignModule,
85             [] foreign_modules: Vec<rustc_session::cstore::ForeignModule>,
86             [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
87             [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
88             [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<'tcx>,
89             [decode] attribute: rustc_ast::Attribute,
90             [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
91             [] hir_id_set: rustc_hir::HirIdSet,
92
93             // Interned types
94             [] tys: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::TyKind<'tcx>>,
95             [] predicates: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::PredicateKind<'tcx>>,
96             [] consts: rustc_middle::ty::ConstS<'tcx>,
97
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,
102             [decode] used_trait_imports: rustc_data_structures::unord::UnordSet<rustc_hir::def_id::LocalDefId>,
103             [decode] is_late_bound_map: rustc_data_structures::fx::FxIndexSet<rustc_hir::def_id::LocalDefId>,
104             [decode] impl_source: rustc_middle::traits::ImplSource<'tcx, ()>,
105
106             [] dep_kind: rustc_middle::dep_graph::DepKindStruct<'tcx>,
107
108             [decode] trait_impl_trait_tys: rustc_data_structures::fx::FxHashMap<rustc_hir::def_id::DefId, rustc_middle::ty::Ty<'tcx>>,
109             [] bit_set_u32: rustc_index::bit_set::BitSet<u32>,
110         ]);
111     )
112 }
113
114 arena_types!(rustc_arena::declare_arena);