@@ -5,7 +5,7 @@ use super::ImplTraitTypeIdVisitor;
55use super :: AnonymousLifetimeMode ;
66use super :: ParamMode ;
77
8- use crate :: hir:: { self , HirVec } ;
8+ use crate :: hir;
99use crate :: hir:: ptr:: P ;
1010use crate :: hir:: def_id:: DefId ;
1111use crate :: hir:: def:: { Res , DefKind } ;
@@ -107,7 +107,7 @@ impl<'a, 'lowering, 'hir> Visitor<'a> for ItemLowerer<'a, 'lowering, 'hir> {
107107 }
108108}
109109
110- impl LoweringContext < ' _ , ' hir > {
110+ impl < ' hir > LoweringContext < ' _ , ' hir > {
111111 // Same as the method above, but accepts `hir::GenericParam`s
112112 // instead of `ast::GenericParam`s.
113113 // This should only be used with generics that have already had their
@@ -1052,7 +1052,7 @@ impl LoweringContext<'_, 'hir> {
10521052 }
10531053 }
10541054
1055- fn record_body ( & mut self , params : HirVec < hir:: Param > , value : hir:: Expr ) -> hir:: BodyId {
1055+ fn record_body ( & mut self , params : & ' hir [ hir :: Param ] , value : hir:: Expr ) -> hir:: BodyId {
10561056 let body = hir:: Body {
10571057 generator_kind : self . generator_kind ,
10581058 params,
@@ -1065,7 +1065,7 @@ impl LoweringContext<'_, 'hir> {
10651065
10661066 fn lower_body (
10671067 & mut self ,
1068- f : impl FnOnce ( & mut LoweringContext < ' _ , ' _ > ) -> ( HirVec < hir:: Param > , hir:: Expr ) ,
1068+ f : impl FnOnce ( & mut Self ) -> ( & ' hir [ hir :: Param ] , hir:: Expr ) ,
10691069 ) -> hir:: BodyId {
10701070 let prev_gen_kind = self . generator_kind . take ( ) ;
10711071 let ( parameters, result) = f ( self ) ;
@@ -1089,7 +1089,9 @@ impl LoweringContext<'_, 'hir> {
10891089 body : impl FnOnce ( & mut LoweringContext < ' _ , ' _ > ) -> hir:: Expr ,
10901090 ) -> hir:: BodyId {
10911091 self . lower_body ( |this| (
1092- decl. inputs . iter ( ) . map ( |x| this. lower_param ( x) ) . collect ( ) ,
1092+ this. arena . alloc_from_iter (
1093+ decl. inputs . iter ( ) . map ( |x| this. lower_param ( x) )
1094+ ) ,
10931095 body ( this) ,
10941096 ) )
10951097 }
@@ -1111,7 +1113,7 @@ impl LoweringContext<'_, 'hir> {
11111113 }
11121114
11131115 pub ( super ) fn lower_const_body ( & mut self , span : Span , expr : Option < & Expr > ) -> hir:: BodyId {
1114- self . lower_body ( |this| ( hir_vec ! [ ] , match expr {
1116+ self . lower_body ( |this| ( & [ ] , match expr {
11151117 Some ( expr) => this. lower_expr ( expr) ,
11161118 None => this. expr_err ( span) ,
11171119 } ) )
@@ -1299,7 +1301,8 @@ impl LoweringContext<'_, 'hir> {
12991301 ) ;
13001302 this. expr_block ( P ( body) , AttrVec :: new ( ) )
13011303 } ) ;
1302- ( HirVec :: from ( parameters) , this. expr ( body_span, async_expr, AttrVec :: new ( ) ) )
1304+
1305+ ( this. arena . alloc_from_iter ( parameters) , this. expr ( body_span, async_expr, AttrVec :: new ( ) ) )
13031306 } )
13041307 }
13051308
0 commit comments