Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_expand/src/lib.rs')
-rw-r--r--crates/hir_expand/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs
index b5970ec964..f411ef9b3c 100644
--- a/crates/hir_expand/src/lib.rs
+++ b/crates/hir_expand/src/lib.rs
@@ -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