@@ -6,6 +6,15 @@ use std::cell::RefCell;
66use  std:: marker:: PhantomData ; 
77use  smallvec:: SmallVec ; 
88
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. 
918#[ macro_export]  
1019macro_rules!  arena_types { 
1120    ( $macro: path,  $args: tt,  $tcx: lifetime)  => ( 
@@ -14,7 +23,7 @@ macro_rules! arena_types {
1423                rustc:: hir:: def_id:: DefId , 
1524                rustc:: ty:: subst:: SubstsRef <$tcx>
1625            ) >, 
17-             [ few]  mir_keys:  rustc:: util:: nodemap:: DefIdSet , 
26+             [ few,  decode ]  mir_keys:  rustc:: util:: nodemap:: DefIdSet , 
1827            [ decode]  specialization_graph:  rustc:: traits:: specialization_graph:: Graph , 
1928            [ ]  region_scope_tree:  rustc:: middle:: region:: ScopeTree , 
2029            [ ]  item_local_set:  rustc:: util:: nodemap:: ItemLocalSet , 
@@ -58,6 +67,40 @@ macro_rules! arena_types {
5867                rustc:: infer:: canonical:: Canonical <' tcx, 
5968                    rustc:: infer:: canonical:: QueryResponse <' tcx,  rustc:: ty:: Ty <' tcx>>
6069                >, 
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>, 
61104        ] ,  $tcx) ; 
62105    ) 
63106} 
@@ -119,7 +162,7 @@ pub trait ArenaAllocatable {}
119162
120163impl < T :  Copy >  ArenaAllocatable  for  T  { } 
121164
122- pub   unsafe  trait  ArenaField < ' tcx > :  Sized  { 
165+ unsafe  trait  ArenaField < ' tcx > :  Sized  { 
123166    /// Returns a specific arena to allocate from. 
124167/// If None is returned, the DropArena will be used. 
125168fn  arena < ' a > ( arena :  & ' a  Arena < ' tcx > )  -> Option < & ' a  TypedArena < Self > > ; 
0 commit comments