@@ -90,6 +90,7 @@ pub struct LoweringContext<'a> {
9090 impl_items : BTreeMap < hir:: ImplItemId , hir:: ImplItem > ,
9191 bodies : BTreeMap < hir:: BodyId , hir:: Body > ,
9292 exported_macros : Vec < hir:: MacroDef > ,
93+ non_exported_macro_attrs : Vec < ast:: Attribute > ,
9394
9495 trait_impls : BTreeMap < DefId , Vec < hir:: HirId > > ,
9596
@@ -252,6 +253,7 @@ pub fn lower_crate(
252253 trait_impls : BTreeMap :: new ( ) ,
253254 modules : BTreeMap :: new ( ) ,
254255 exported_macros : Vec :: new ( ) ,
256+ non_exported_macro_attrs : Vec :: new ( ) ,
255257 catch_scopes : Vec :: new ( ) ,
256258 loop_scopes : Vec :: new ( ) ,
257259 is_in_loop_condition : false ,
@@ -662,6 +664,7 @@ impl<'a> LoweringContext<'a> {
662664 attrs,
663665 span : c. span ,
664666 exported_macros : hir:: HirVec :: from ( self . exported_macros ) ,
667+ non_exported_macro_attrs : hir:: HirVec :: from ( self . non_exported_macro_attrs ) ,
665668 items : self . items ,
666669 trait_items : self . trait_items ,
667670 impl_items : self . impl_items ,
@@ -4022,6 +4025,8 @@ impl<'a> LoweringContext<'a> {
40224025 body,
40234026 legacy : def. legacy ,
40244027 } ) ;
4028+ } else {
4029+ self . non_exported_macro_attrs . extend ( attrs. into_iter ( ) ) ;
40254030 }
40264031 return None ;
40274032 }
0 commit comments