@@ -42,7 +42,6 @@ extern crate tracing;
42
42
43
43
use crate :: errors:: { AssocTyParentheses , AssocTyParenthesesSub , MisplacedImplTrait , TraitFnAsync } ;
44
44
45
- use rustc_arena:: declare_arena;
46
45
use rustc_ast:: ptr:: P ;
47
46
use rustc_ast:: visit;
48
47
use rustc_ast:: { self as ast, * } ;
@@ -94,13 +93,6 @@ struct LoweringContext<'a, 'hir> {
94
93
/// Used to allocate HIR nodes.
95
94
arena : & ' hir hir:: Arena < ' hir > ,
96
95
97
- /// Used to allocate temporary AST nodes for use during lowering.
98
- /// This allows us to create "fake" AST -- these nodes can sometimes
99
- /// be allocated on the stack, but other times we need them to live longer
100
- /// than the current stack frame, so they can be collected into vectors
101
- /// and things like that.
102
- ast_arena : & ' a Arena < ' static > ,
103
-
104
96
/// Bodies inside the owner being lowered.
105
97
bodies : Vec < ( hir:: ItemLocalId , & ' hir hir:: Body < ' hir > ) > ,
106
98
/// Attributes inside the owner being lowered.
@@ -146,15 +138,6 @@ struct LoweringContext<'a, 'hir> {
146
138
generics_def_id_map : Vec < FxHashMap < LocalDefId , LocalDefId > > ,
147
139
}
148
140
149
- declare_arena ! ( [
150
- [ ] tys: rustc_ast:: Ty ,
151
- [ ] aba: rustc_ast:: AngleBracketedArgs ,
152
- [ ] ptr: rustc_ast:: PolyTraitRef ,
153
- // This _marker field is needed because `declare_arena` creates `Arena<'tcx>` and we need to
154
- // use `'tcx`. If we don't have this we get a compile error.
155
- [ ] _marker: std:: marker:: PhantomData <& ' tcx ( ) >,
156
- ] ) ;
157
-
158
141
trait ResolverAstLoweringExt {
159
142
fn legacy_const_generic_args ( & self , expr : & Expr ) -> Option < Vec < usize > > ;
160
143
fn get_partial_res ( & self , id : NodeId ) -> Option < PartialRes > ;
@@ -442,13 +425,10 @@ pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> {
442
425
tcx. definitions_untracked ( ) . def_index_count ( ) ,
443
426
) ;
444
427
445
- let ast_arena = Arena :: default ( ) ;
446
-
447
428
for def_id in ast_index. indices ( ) {
448
429
item:: ItemLowerer {
449
430
tcx,
450
431
resolver : & mut resolver,
451
- ast_arena : & ast_arena,
452
432
ast_index : & ast_index,
453
433
owners : & mut owners,
454
434
}
@@ -1001,8 +981,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1001
981
}
1002
982
GenericArgs :: Parenthesized ( data) => {
1003
983
self . emit_bad_parenthesized_trait_in_assoc_ty ( data) ;
1004
- let aba = self . ast_arena . aba . alloc ( data. as_angle_bracketed_args ( ) ) ;
1005
- self . lower_angle_bracketed_parameter_data ( aba, ParamMode :: Explicit , itctx) . 0
984
+ self . lower_angle_bracketed_parameter_data (
985
+ & data. as_angle_bracketed_args ( ) ,
986
+ ParamMode :: Explicit ,
987
+ itctx,
988
+ )
989
+ . 0
1006
990
}
1007
991
} ;
1008
992
gen_args_ctor. into_generic_args ( self )
@@ -1067,13 +1051,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1067
1051
1068
1052
self . with_dyn_type_scope ( false , |this| {
1069
1053
let node_id = this. next_node_id ( ) ;
1070
- let ty = this. ast_arena . tys . alloc ( Ty {
1071
- id : node_id,
1072
- kind : TyKind :: ImplTrait ( impl_trait_node_id, bounds. clone ( ) ) ,
1073
- span : this. lower_span ( constraint. span ) ,
1074
- tokens : None ,
1075
- } ) ;
1076
- let ty = this. lower_ty ( ty, itctx) ;
1054
+ let ty = this. lower_ty (
1055
+ & Ty {
1056
+ id : node_id,
1057
+ kind : TyKind :: ImplTrait ( impl_trait_node_id, bounds. clone ( ) ) ,
1058
+ span : this. lower_span ( constraint. span ) ,
1059
+ tokens : None ,
1060
+ } ,
1061
+ itctx,
1062
+ ) ;
1077
1063
1078
1064
hir:: TypeBindingKind :: Equality { term : ty. into ( ) }
1079
1065
} )
@@ -1217,13 +1203,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1217
1203
&& let Some ( Res :: Def ( DefKind :: Trait | DefKind :: TraitAlias , _) ) = partial_res. full_res ( )
1218
1204
{
1219
1205
let ( bounds, lifetime_bound) = self . with_dyn_type_scope ( true , |this| {
1220
- let poly_trait_ref = this. ast_arena . ptr . alloc ( PolyTraitRef {
1221
- bound_generic_params : vec ! [ ] ,
1222
- trait_ref : TraitRef { path : path. clone ( ) , ref_id : t. id } ,
1223
- span : t. span
1224
- } ) ;
1225
1206
let bound = this. lower_poly_trait_ref (
1226
- poly_trait_ref,
1207
+ & PolyTraitRef {
1208
+ bound_generic_params : vec ! [ ] ,
1209
+ trait_ref : TraitRef { path : path. clone ( ) , ref_id : t. id } ,
1210
+ span : t. span
1211
+ } ,
1227
1212
itctx,
1228
1213
) ;
1229
1214
let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
0 commit comments