@@ -296,7 +296,7 @@ pub fn lower_crate<'a, 'hir>(
296
296
resolver : & ' a mut dyn ResolverAstLowering ,
297
297
nt_to_tokenstream : NtToTokenstream ,
298
298
arena : & ' hir Arena < ' hir > ,
299
- ) -> hir:: Crate < ' hir > {
299
+ ) -> & ' hir hir:: Crate < ' hir > {
300
300
let _prof_timer = sess. prof . verbose_generic_activity ( "hir_lowering" ) ;
301
301
302
302
LoweringContext {
@@ -403,7 +403,7 @@ enum AnonymousLifetimeMode {
403
403
}
404
404
405
405
impl < ' a , ' hir > LoweringContext < ' a , ' hir > {
406
- fn lower_crate ( mut self , c : & Crate ) -> hir:: Crate < ' hir > {
406
+ fn lower_crate ( mut self , c : & Crate ) -> & ' hir hir:: Crate < ' hir > {
407
407
/// Full-crate AST visitor that inserts into a fresh
408
408
/// `LoweringContext` any information that may be
409
409
/// needed from arbitrary locations in the crate,
@@ -530,7 +530,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
530
530
}
531
531
}
532
532
533
- hir:: Crate {
533
+ let krate = hir:: Crate {
534
534
item : module,
535
535
exported_macros : self . arena . alloc_from_iter ( self . exported_macros ) ,
536
536
non_exported_macro_attrs : self . arena . alloc_from_iter ( self . non_exported_macro_attrs ) ,
@@ -545,7 +545,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
545
545
proc_macros,
546
546
trait_map,
547
547
attrs : self . attrs ,
548
- }
548
+ } ;
549
+ self . arena . alloc ( krate)
549
550
}
550
551
551
552
fn insert_item ( & mut self , item : hir:: Item < ' hir > ) -> hir:: ItemId {
0 commit comments