@@ -990,6 +990,9 @@ pub struct Resolver<'a> {
990
990
crate_loader : CrateLoader < ' a > ,
991
991
macro_names : FxHashSet < Ident > ,
992
992
builtin_macros : FxHashMap < Symbol , BuiltinMacroState > ,
993
+ /// A small map keeping true kinds of built-in macros that appear to be fn-like on
994
+ /// the surface (`macro` items in libcore), but are actually attributes or derives.
995
+ builtin_macro_kinds : FxHashMap < LocalDefId , MacroKind > ,
993
996
registered_attrs : FxHashSet < Ident > ,
994
997
registered_tools : RegisteredTools ,
995
998
macro_use_prelude : FxHashMap < Symbol , & ' a NameBinding < ' a > > ,
@@ -1261,6 +1264,10 @@ impl ResolverAstLowering for Resolver<'_> {
1261
1264
1262
1265
def_id
1263
1266
}
1267
+
1268
+ fn decl_macro_kind ( & self , def_id : LocalDefId ) -> MacroKind {
1269
+ self . builtin_macro_kinds . get ( & def_id) . copied ( ) . unwrap_or ( MacroKind :: Bang )
1270
+ }
1264
1271
}
1265
1272
1266
1273
impl < ' a > Resolver < ' a > {
@@ -1381,6 +1388,7 @@ impl<'a> Resolver<'a> {
1381
1388
crate_loader : CrateLoader :: new ( session, metadata_loader, crate_name) ,
1382
1389
macro_names : FxHashSet :: default ( ) ,
1383
1390
builtin_macros : Default :: default ( ) ,
1391
+ builtin_macro_kinds : Default :: default ( ) ,
1384
1392
registered_attrs,
1385
1393
registered_tools,
1386
1394
macro_use_prelude : FxHashMap :: default ( ) ,
0 commit comments