@@ -1077,6 +1077,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1077
1077
res,
1078
1078
vis : ty:: Visibility :: Public ,
1079
1079
span : ident. span ,
1080
+ macro_rules : false ,
1080
1081
} ) ;
1081
1082
}
1082
1083
}
@@ -1088,17 +1089,19 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1088
1089
for child_index in children. decode ( ( self , sess) ) {
1089
1090
if let Some ( ident) = self . opt_item_ident ( child_index, sess) {
1090
1091
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
- }
1096
1092
let def_id = self . local_def_id ( child_index) ;
1097
1093
let res = Res :: Def ( kind, def_id) ;
1098
1094
let vis = self . get_visibility ( child_index) ;
1099
1095
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
+ } ;
1100
1103
1101
- callback ( ModChild { ident, res, vis, span } ) ;
1104
+ callback ( ModChild { ident, res, vis, span, macro_rules } ) ;
1102
1105
1103
1106
// For non-re-export structs and variants add their constructors to children.
1104
1107
// Re-export lists automatically contain constructors when necessary.
@@ -1110,7 +1113,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1110
1113
let ctor_res =
1111
1114
Res :: Def ( DefKind :: Ctor ( CtorOf :: Struct , ctor_kind) , ctor_def_id) ;
1112
1115
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
+ } ) ;
1114
1123
}
1115
1124
}
1116
1125
DefKind :: Variant => {
@@ -1135,7 +1144,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1135
1144
vis = ty:: Visibility :: Restricted ( crate_def_id) ;
1136
1145
}
1137
1146
}
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
+ } ) ;
1139
1154
}
1140
1155
_ => { }
1141
1156
}
0 commit comments