@@ -296,7 +296,7 @@ pub fn lower_crate<'a, 'hir>(
296296 resolver : & ' a mut dyn ResolverAstLowering ,
297297 nt_to_tokenstream : NtToTokenstream ,
298298 arena : & ' hir Arena < ' hir > ,
299- ) -> hir:: Crate < ' hir > {
299+ ) -> & ' hir hir:: Crate < ' hir > {
300300 let _prof_timer = sess. prof . verbose_generic_activity ( "hir_lowering" ) ;
301301
302302 LoweringContext {
@@ -403,7 +403,7 @@ enum AnonymousLifetimeMode {
403403}
404404
405405impl < ' 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 > {
407407 /// Full-crate AST visitor that inserts into a fresh
408408 /// `LoweringContext` any information that may be
409409 /// needed from arbitrary locations in the crate,
@@ -530,7 +530,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
530530 }
531531 }
532532
533- hir:: Crate {
533+ let krate = hir:: Crate {
534534 item : module,
535535 exported_macros : self . arena . alloc_from_iter ( self . exported_macros ) ,
536536 non_exported_macro_attrs : self . arena . alloc_from_iter ( self . non_exported_macro_attrs ) ,
@@ -545,7 +545,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
545545 proc_macros,
546546 trait_map,
547547 attrs : self . attrs ,
548- }
548+ } ;
549+ self . arena . alloc ( krate)
549550 }
550551
551552 fn insert_item ( & mut self , item : hir:: Item < ' hir > ) -> hir:: ItemId {
0 commit comments