@@ -42,7 +42,6 @@ extern crate tracing;
4242
4343use crate :: errors:: { AssocTyParentheses , AssocTyParenthesesSub , MisplacedImplTrait , TraitFnAsync } ;
4444
45- use rustc_arena:: declare_arena;
4645use rustc_ast:: ptr:: P ;
4746use rustc_ast:: visit;
4847use rustc_ast:: { self as ast, * } ;
@@ -94,13 +93,6 @@ struct LoweringContext<'a, 'hir> {
9493 /// Used to allocate HIR nodes.
9594 arena : & ' hir hir:: Arena < ' hir > ,
9695
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-
10496 /// Bodies inside the owner being lowered.
10597 bodies : Vec < ( hir:: ItemLocalId , & ' hir hir:: Body < ' hir > ) > ,
10698 /// Attributes inside the owner being lowered.
@@ -146,15 +138,6 @@ struct LoweringContext<'a, 'hir> {
146138 generics_def_id_map : Vec < FxHashMap < LocalDefId , LocalDefId > > ,
147139}
148140
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-
158141trait ResolverAstLoweringExt {
159142 fn legacy_const_generic_args ( & self , expr : & Expr ) -> Option < Vec < usize > > ;
160143 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> {
442425 tcx. definitions_untracked ( ) . def_index_count ( ) ,
443426 ) ;
444427
445- let ast_arena = Arena :: default ( ) ;
446-
447428 for def_id in ast_index. indices ( ) {
448429 item:: ItemLowerer {
449430 tcx,
450431 resolver : & mut resolver,
451- ast_arena : & ast_arena,
452432 ast_index : & ast_index,
453433 owners : & mut owners,
454434 }
@@ -1001,8 +981,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1001981 }
1002982 GenericArgs :: Parenthesized ( data) => {
1003983 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
1006990 }
1007991 } ;
1008992 gen_args_ctor. into_generic_args ( self )
@@ -1067,13 +1051,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10671051
10681052 self . with_dyn_type_scope ( false , |this| {
10691053 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+ ) ;
10771063
10781064 hir:: TypeBindingKind :: Equality { term : ty. into ( ) }
10791065 } )
@@ -1217,13 +1203,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12171203 && let Some ( Res :: Def ( DefKind :: Trait | DefKind :: TraitAlias , _) ) = partial_res. full_res ( )
12181204 {
12191205 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- } ) ;
12251206 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+ } ,
12271212 itctx,
12281213 ) ;
12291214 let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
0 commit comments