Don't resolve attributes to non attribute macros

This commit is contained in:
Lukas Wirth
2021-10-21 12:21:34 +02:00
parent 96fbef606a
commit ea2a2c52fc
7 changed files with 38 additions and 8 deletions

View File

@@ -306,6 +306,13 @@ impl MacroDefId {
pub fn is_proc_macro(&self) -> bool {
matches!(self.kind, MacroDefKind::ProcMacro(..))
}
pub fn is_attribute(&self) -> bool {
matches!(
self.kind,
MacroDefKind::BuiltInAttr(..) | MacroDefKind::ProcMacro(_, ProcMacroKind::Attr, _)
)
}
}
// FIXME: attribute indices do not account for `cfg_attr`, which means that we'll strip the whole