1
Fork 0

resolve: Fix incorrect results of opt_def_kind query for some built-in macros

Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
This commit is contained in:
Vadim Petrochenkov 2021-12-11 19:52:23 +08:00
parent 4b043faba3
commit 17b1afdbb2
17 changed files with 35 additions and 19 deletions

View file

@ -1209,7 +1209,13 @@ impl<'a> Resolver<'a> {
// while still taking everything else from the source code.
// If we already loaded this builtin macro, give a better error message than 'no such builtin macro'.
match mem::replace(builtin_macro, BuiltinMacroState::AlreadySeen(item.span)) {
BuiltinMacroState::NotYetSeen(ext) => result.kind = ext,
BuiltinMacroState::NotYetSeen(ext) => {
result.kind = ext;
if item.id != ast::DUMMY_NODE_ID {
self.builtin_macro_kinds
.insert(self.local_def_id(item.id), result.macro_kind());
}
}
BuiltinMacroState::AlreadySeen(span) => {
struct_span_err!(
self.session,