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:
parent
4b043faba3
commit
17b1afdbb2
17 changed files with 35 additions and 19 deletions
|
@ -444,8 +444,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
),
|
||||
ItemKind::MacroDef(MacroDef { ref body, macro_rules }) => {
|
||||
let body = P(self.lower_mac_args(body));
|
||||
|
||||
hir::ItemKind::Macro(ast::MacroDef { body, macro_rules })
|
||||
let macro_kind = self.resolver.decl_macro_kind(self.resolver.local_def_id(id));
|
||||
hir::ItemKind::Macro(ast::MacroDef { body, macro_rules }, macro_kind)
|
||||
}
|
||||
ItemKind::MacCall(..) => {
|
||||
panic!("`TyMac` should have been expanded by now")
|
||||
|
|
|
@ -61,7 +61,7 @@ use rustc_session::lint::LintBuffer;
|
|||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::utils::{FlattenNonterminals, NtToTokenstream};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::hygiene::{ExpnId, MacroKind};
|
||||
use rustc_span::source_map::{respan, DesugaringKind};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -210,6 +210,8 @@ pub trait ResolverAstLowering {
|
|||
expn_id: ExpnId,
|
||||
span: Span,
|
||||
) -> LocalDefId;
|
||||
|
||||
fn decl_macro_kind(&self, def_id: LocalDefId) -> MacroKind;
|
||||
}
|
||||
|
||||
/// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue