@@ -1178,14 +1178,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1178
1178
tokens : None ,
1179
1179
} ;
1180
1180
1181
- let ct = self . with_new_scopes ( span, |this| hir:: AnonConst {
1182
- def_id,
1183
- hir_id : this. lower_node_id ( node_id) ,
1184
- body : this. lower_const_body ( path_expr. span , Some ( & path_expr) ) ,
1181
+ let ct = self . with_new_scopes ( span, |this| {
1182
+ self . arena . alloc ( hir:: AnonConst {
1183
+ def_id,
1184
+ hir_id : this. lower_node_id ( node_id) ,
1185
+ body : this
1186
+ . lower_const_body ( path_expr. span , Some ( & path_expr) ) ,
1187
+ span,
1188
+ } )
1185
1189
} ) ;
1186
1190
return GenericArg :: Const ( ConstArg {
1187
1191
value : ct,
1188
- span,
1189
1192
is_desugared_from_effects : false ,
1190
1193
} ) ;
1191
1194
}
@@ -1197,7 +1200,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1197
1200
}
1198
1201
ast:: GenericArg :: Const ( ct) => GenericArg :: Const ( ConstArg {
1199
1202
value : self . lower_anon_const ( ct) ,
1200
- span : self . lower_span ( ct. value . span ) ,
1201
1203
is_desugared_from_effects : false ,
1202
1204
} ) ,
1203
1205
}
@@ -2315,7 +2317,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2315
2317
}
2316
2318
2317
2319
#[ allow( rustc:: untranslatable_diagnostic) ] // FIXME: make this translatable
2318
- fn lower_array_length ( & mut self , c : & AnonConst ) -> hir:: ArrayLen {
2320
+ fn lower_array_length ( & mut self , c : & AnonConst ) -> hir:: ArrayLen < ' hir > {
2319
2321
match c. value . kind {
2320
2322
ExprKind :: Underscore => {
2321
2323
if self . tcx . features ( ) . generic_arg_infer {
@@ -2338,12 +2340,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2338
2340
}
2339
2341
}
2340
2342
2341
- fn lower_anon_const ( & mut self , c : & AnonConst ) -> hir:: AnonConst {
2342
- self . with_new_scopes ( c. value . span , |this| hir:: AnonConst {
2343
+ fn lower_anon_const ( & mut self , c : & AnonConst ) -> & ' hir hir:: AnonConst {
2344
+ self . arena . alloc ( self . with_new_scopes ( c. value . span , |this| hir:: AnonConst {
2343
2345
def_id : this. local_def_id ( c. id ) ,
2344
2346
hir_id : this. lower_node_id ( c. id ) ,
2345
2347
body : this. lower_const_body ( c. value . span , Some ( & c. value ) ) ,
2346
- } )
2348
+ span : this. lower_span ( c. value . span ) ,
2349
+ } ) )
2347
2350
}
2348
2351
2349
2352
fn lower_unsafe_source ( & mut self , u : UnsafeSource ) -> hir:: UnsafeSource {
@@ -2650,8 +2653,7 @@ impl<'hir> GenericArgsCtor<'hir> {
2650
2653
2651
2654
lcx. children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
2652
2655
self . args . push ( hir:: GenericArg :: Const ( hir:: ConstArg {
2653
- value : hir:: AnonConst { def_id, hir_id, body } ,
2654
- span,
2656
+ value : lcx. arena . alloc ( hir:: AnonConst { def_id, hir_id, body, span } ) ,
2655
2657
is_desugared_from_effects : true ,
2656
2658
} ) )
2657
2659
}
0 commit comments