Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r--crates/hir/src/semantics.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index d0202c1054..562c78809a 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -1088,7 +1088,12 @@ impl<'db> SemanticsImpl<'db> {
/// That is, we strictly check if it lies inside the input of a macro call.
pub fn is_inside_macro_call(&self, token @ InFile { value, .. }: InFile<&SyntaxToken>) -> bool {
value.parent_ancestors().any(|ancestor| {
- if ast::MacroCall::can_cast(ancestor.kind()) {
+ if let Some(macro_call) = ast::MacroCall::cast(ancestor.clone())
+ // If this is the *path* of a macro, it's not inside the call.
+ && macro_call.path().is_none_or(|path| {
+ !path.syntax().text_range().contains_range(value.text_range())
+ })
+ {
return true;
}