aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-23 12:05:45 +0000
committerGitHub <[email protected]>2021-03-23 12:05:45 +0000
commit258afb8fb8331e43a75e4f19df255d85d2430be7 (patch)
tree41bafbd0806672f10882aa02d4558e44137beea7 /crates/hir
parent1efd220f2f844596dd22bfd73a8a0c596354be38 (diff)
parent395183e0b7609dfb0d21f135879dc8f3d8e97e41 (diff)
Merge #8138
8138: Set up a search scope when searching for mbe macro references r=Veykril a=Veykril Closes #6184 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 68f4551c0..5da6a0340 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1117,6 +1117,14 @@ impl BuiltinType {
1117} 1117}
1118 1118
1119#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 1119#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1120pub enum MacroKind {
1121 Declarative,
1122 ProcMacro,
1123 Derive,
1124 BuiltIn,
1125}
1126
1127#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1120pub struct MacroDef { 1128pub struct MacroDef {
1121 pub(crate) id: MacroDefId, 1129 pub(crate) id: MacroDefId,
1122} 1130}
@@ -1140,15 +1148,15 @@ impl MacroDef {
1140 } 1148 }
1141 } 1149 }
1142 1150
1143 /// Indicate it is a proc-macro 1151 pub fn kind(&self) -> MacroKind {
1144 pub fn is_proc_macro(&self) -> bool { 1152 match self.id.kind {
1145 matches!(self.id.kind, MacroDefKind::ProcMacro(..)) 1153 MacroDefKind::Declarative(_) => MacroKind::Declarative,
1146 } 1154 MacroDefKind::BuiltIn(_, _) => MacroKind::BuiltIn,
1147 1155 MacroDefKind::BuiltInDerive(_, _) => MacroKind::Derive,
1148 /// Indicate it is a derive macro 1156 MacroDefKind::BuiltInEager(_, _) => MacroKind::BuiltIn,
1149 pub fn is_derive_macro(&self) -> bool { 1157 // FIXME might be a derive
1150 // FIXME: wrong for `ProcMacro` 1158 MacroDefKind::ProcMacro(_, _) => MacroKind::ProcMacro,
1151 matches!(self.id.kind, MacroDefKind::ProcMacro(..) | MacroDefKind::BuiltInDerive(..)) 1159 }
1152 } 1160 }
1153} 1161}
1154 1162