@@ -1077,6 +1077,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10771077 res,
10781078 vis : ty:: Visibility :: Public ,
10791079 span : ident. span ,
1080+ macro_rules : false ,
10801081 } ) ;
10811082 }
10821083 }
@@ -1088,17 +1089,19 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10881089 for child_index in children. decode ( ( self , sess) ) {
10891090 if let Some ( ident) = self . opt_item_ident ( child_index, sess) {
10901091 let kind = self . def_kind ( child_index) ;
1091- if matches ! ( kind, DefKind :: Macro ( ..) ) {
1092- // FIXME: Macros are currently encoded twice, once as items and once as
1093- // reexports. We ignore the items here and only use the reexports.
1094- continue ;
1095- }
10961092 let def_id = self . local_def_id ( child_index) ;
10971093 let res = Res :: Def ( kind, def_id) ;
10981094 let vis = self . get_visibility ( child_index) ;
10991095 let span = self . get_span ( child_index, sess) ;
1096+ let macro_rules = match kind {
1097+ DefKind :: Macro ( ..) => match self . kind ( child_index) {
1098+ EntryKind :: MacroDef ( _, macro_rules) => macro_rules,
1099+ _ => unreachable ! ( ) ,
1100+ } ,
1101+ _ => false ,
1102+ } ;
11001103
1101- callback ( ModChild { ident, res, vis, span } ) ;
1104+ callback ( ModChild { ident, res, vis, span, macro_rules } ) ;
11021105
11031106 // For non-re-export structs and variants add their constructors to children.
11041107 // Re-export lists automatically contain constructors when necessary.
@@ -1110,7 +1113,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11101113 let ctor_res =
11111114 Res :: Def ( DefKind :: Ctor ( CtorOf :: Struct , ctor_kind) , ctor_def_id) ;
11121115 let vis = self . get_visibility ( ctor_def_id. index ) ;
1113- callback ( ModChild { ident, res : ctor_res, vis, span } ) ;
1116+ callback ( ModChild {
1117+ ident,
1118+ res : ctor_res,
1119+ vis,
1120+ span,
1121+ macro_rules : false ,
1122+ } ) ;
11141123 }
11151124 }
11161125 DefKind :: Variant => {
@@ -1135,7 +1144,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11351144 vis = ty:: Visibility :: Restricted ( crate_def_id) ;
11361145 }
11371146 }
1138- callback ( ModChild { ident, res : ctor_res, vis, span } ) ;
1147+ callback ( ModChild {
1148+ ident,
1149+ res : ctor_res,
1150+ vis,
1151+ span,
1152+ macro_rules : false ,
1153+ } ) ;
11391154 }
11401155 _ => { }
11411156 }
0 commit comments