]> git.lizzy.rs Git - rust.git/blob - src/librustc_middle/arena.rs
librustc_middle: Rename upvars query to upvars_mentioned
[rust.git] / src / librustc_middle / arena.rs
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 ///
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.
10 #[macro_export]
11 macro_rules! arena_types {
12     ($macro:path, $args:tt, $tcx:lifetime) => (
13         $macro!($args, [
14             [] layouts: rustc_target::abi::Layout,
15             // AdtDef are interned and compared by address
16             [] adt_def: rustc_middle::ty::AdtDef,
17             [decode] tables: rustc_middle::ty::TypeckTables<$tcx>,
18             [] const_allocs: rustc_middle::mir::interpret::Allocation,
19             // Required for the incremental on-disk cache
20             [few, decode] mir_keys: rustc_hir::def_id::DefIdSet,
21             [] region_scope_tree: rustc_middle::middle::region::ScopeTree,
22             [] dropck_outlives:
23                 rustc_middle::infer::canonical::Canonical<'tcx,
24                     rustc_middle::infer::canonical::QueryResponse<'tcx,
25                         rustc_middle::traits::query::DropckOutlivesResult<'tcx>
26                     >
27                 >,
28             [] normalize_projection_ty:
29                 rustc_middle::infer::canonical::Canonical<'tcx,
30                     rustc_middle::infer::canonical::QueryResponse<'tcx,
31                         rustc_middle::traits::query::NormalizationResult<'tcx>
32                     >
33                 >,
34             [] implied_outlives_bounds:
35                 rustc_middle::infer::canonical::Canonical<'tcx,
36                     rustc_middle::infer::canonical::QueryResponse<'tcx,
37                         Vec<rustc_middle::traits::query::OutlivesBound<'tcx>>
38                     >
39                 >,
40             [] type_op_subtype:
41                 rustc_middle::infer::canonical::Canonical<'tcx,
42                     rustc_middle::infer::canonical::QueryResponse<'tcx, ()>
43                 >,
44             [] type_op_normalize_poly_fn_sig:
45                 rustc_middle::infer::canonical::Canonical<'tcx,
46                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::PolyFnSig<'tcx>>
47                 >,
48             [] type_op_normalize_fn_sig:
49                 rustc_middle::infer::canonical::Canonical<'tcx,
50                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::FnSig<'tcx>>
51                 >,
52             [] type_op_normalize_predicate:
53                 rustc_middle::infer::canonical::Canonical<'tcx,
54                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Predicate<'tcx>>
55                 >,
56             [] type_op_normalize_ty:
57                 rustc_middle::infer::canonical::Canonical<'tcx,
58                     rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>>
59                 >,
60             [few] all_traits: Vec<rustc_hir::def_id::DefId>,
61             [few] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels,
62             [few] foreign_module: rustc_middle::middle::cstore::ForeignModule,
63             [few] foreign_modules: Vec<rustc_middle::middle::cstore::ForeignModule>,
64             [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
65             [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
66             [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
67             [] attribute: rustc_ast::ast::Attribute,
68             [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
69             [] hir_id_set: rustc_hir::HirIdSet,
70
71             // Interned types
72             [] tys: rustc_middle::ty::TyS<$tcx>,
73
74             // HIR query types
75             [few] indexed_hir: rustc_middle::hir::map::IndexedHir<$tcx>,
76             [few] hir_definitions: rustc_hir::definitions::Definitions,
77             [] hir_owner: rustc_middle::hir::Owner<$tcx>,
78             [] hir_owner_nodes: rustc_middle::hir::OwnerNodes<$tcx>,
79
80             // Note that this deliberately duplicates items in the `rustc_hir::arena`,
81             // since we need to allocate this type on both the `rustc_hir` arena
82             // (during lowering) and the `librustc_middle` arena (for decoding MIR)
83             [decode] asm_template: rustc_ast::ast::InlineAsmTemplatePiece,
84
85         ], $tcx);
86     )
87 }
88
89 arena_types!(arena::declare_arena, [], 'tcx);