@@ -6,6 +6,15 @@ use std::cell::RefCell;
6
6
use std:: marker:: PhantomData ;
7
7
use smallvec:: SmallVec ;
8
8
9
+ /// This declares a list of types which can be allocated by `Arena`.
10
+ ///
11
+ /// The `few` modifier will cause allocation to use the shared arena and recording the destructor.
12
+ /// This is faster and more memory efficient if there's only a few allocations of the type.
13
+ /// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is
14
+ /// faster and more memory efficient if there is lots of allocations.
15
+ ///
16
+ /// Specifying the `decode` modifier will add decode impls for &T and &[T] where T is the type
17
+ /// listed. These impls will appear in the implement_ty_decoder! macro.
9
18
#[ macro_export]
10
19
macro_rules! arena_types {
11
20
( $macro: path, $args: tt, $tcx: lifetime) => (
@@ -14,7 +23,7 @@ macro_rules! arena_types {
14
23
rustc:: hir:: def_id:: DefId ,
15
24
rustc:: ty:: subst:: SubstsRef <$tcx>
16
25
) >,
17
- [ few] mir_keys: rustc:: util:: nodemap:: DefIdSet ,
26
+ [ few, decode ] mir_keys: rustc:: util:: nodemap:: DefIdSet ,
18
27
[ decode] specialization_graph: rustc:: traits:: specialization_graph:: Graph ,
19
28
[ ] region_scope_tree: rustc:: middle:: region:: ScopeTree ,
20
29
[ ] item_local_set: rustc:: util:: nodemap:: ItemLocalSet ,
@@ -58,6 +67,40 @@ macro_rules! arena_types {
58
67
rustc:: infer:: canonical:: Canonical <' tcx,
59
68
rustc:: infer:: canonical:: QueryResponse <' tcx, rustc:: ty:: Ty <' tcx>>
60
69
>,
70
+ [ few] crate_inherent_impls: rustc:: ty:: CrateInherentImpls ,
71
+ [ decode] borrowck: rustc:: middle:: borrowck:: BorrowCheckResult ,
72
+ [ few] upstream_monomorphizations:
73
+ rustc:: util:: nodemap:: DefIdMap <
74
+ rustc_data_structures:: fx:: FxHashMap <
75
+ rustc:: ty:: subst:: SubstsRef <' tcx>,
76
+ rustc:: hir:: def_id:: CrateNum
77
+ >
78
+ >,
79
+ [ few] resolve_lifetimes: rustc:: middle:: resolve_lifetime:: ResolveLifetimes ,
80
+ [ decode] generic_predicates: rustc:: ty:: GenericPredicates <' tcx>,
81
+ [ few] lint_levels: rustc:: lint:: LintLevelMap ,
82
+ [ few] stability_index: rustc:: middle:: stability:: Index <' tcx>,
83
+ [ few] features: syntax:: feature_gate:: Features ,
84
+ [ few] all_traits: Vec <rustc:: hir:: def_id:: DefId >,
85
+ [ few] privacy_access_levels: rustc:: middle:: privacy:: AccessLevels ,
86
+ [ few] target_features_whitelist: rustc_data_structures:: fx:: FxHashMap <
87
+ String ,
88
+ Option <syntax:: symbol:: Symbol >
89
+ >,
90
+ [ few] wasm_import_module_map: rustc_data_structures:: fx:: FxHashMap <
91
+ rustc:: hir:: def_id:: DefId ,
92
+ String
93
+ >,
94
+ [ few] get_lib_features: rustc:: middle:: lib_features:: LibFeatures ,
95
+ [ few] defined_lib_features: rustc:: middle:: lang_items:: LanguageItems ,
96
+ [ few] visible_parent_map: rustc:: util:: nodemap:: DefIdMap <rustc:: hir:: def_id:: DefId >,
97
+ [ few] foreign_module: rustc:: middle:: cstore:: ForeignModule ,
98
+ [ few] foreign_modules: Vec <rustc:: middle:: cstore:: ForeignModule >,
99
+ [ few] reachable_non_generics: rustc:: util:: nodemap:: DefIdMap <
100
+ rustc:: middle:: exported_symbols:: SymbolExportLevel
101
+ >,
102
+ [ few] crate_variances: rustc:: ty:: CrateVariancesMap <' tcx>,
103
+ [ few] inferred_outlives_crate: rustc:: ty:: CratePredicatesMap <' tcx>,
61
104
] , $tcx) ;
62
105
)
63
106
}
@@ -119,7 +162,7 @@ pub trait ArenaAllocatable {}
119
162
120
163
impl < T : Copy > ArenaAllocatable for T { }
121
164
122
- pub unsafe trait ArenaField < ' tcx > : Sized {
165
+ unsafe trait ArenaField < ' tcx > : Sized {
123
166
/// Returns a specific arena to allocate from.
124
167
/// If None is returned, the DropArena will be used.
125
168
fn arena < ' a > ( arena : & ' a Arena < ' tcx > ) -> Option < & ' a TypedArena < Self > > ;
0 commit comments