diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_def/src/path/lower.rs | 14 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index e632f1afb..b902cacd1 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs | |||
@@ -9,10 +9,7 @@ use hir_expand::{ | |||
9 | hygiene::Hygiene, | 9 | hygiene::Hygiene, |
10 | name::{name, AsName}, | 10 | name::{name, AsName}, |
11 | }; | 11 | }; |
12 | use ra_syntax::{ | 12 | use ra_syntax::ast::{self, AstNode, TypeAscriptionOwner, TypeBoundsOwner}; |
13 | ast::{self, AstNode, TypeAscriptionOwner, TypeBoundsOwner}, | ||
14 | T, | ||
15 | }; | ||
16 | 13 | ||
17 | use super::AssociatedTypeBinding; | 14 | use super::AssociatedTypeBinding; |
18 | use crate::{ | 15 | use crate::{ |
@@ -122,10 +119,11 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> | |||
122 | // https://github.com/rust-lang/rust/blob/614f273e9388ddd7804d5cbc80b8865068a3744e/src/librustc_resolve/macros.rs#L456 | 119 | // https://github.com/rust-lang/rust/blob/614f273e9388ddd7804d5cbc80b8865068a3744e/src/librustc_resolve/macros.rs#L456 |
123 | // We follow what it did anyway :) | 120 | // We follow what it did anyway :) |
124 | if segments.len() == 1 && kind == PathKind::Plain { | 121 | if segments.len() == 1 && kind == PathKind::Plain { |
125 | let next = path.syntax().last_token().and_then(|it| it.next_token()); | 122 | if let Some(macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) { |
126 | if next.map_or(false, |it| it.kind() == T![!]) { | 123 | if macro_call.is_bang() { |
127 | if let Some(crate_id) = hygiene.local_inner_macros() { | 124 | if let Some(crate_id) = hygiene.local_inner_macros() { |
128 | kind = PathKind::DollarCrate(crate_id); | 125 | kind = PathKind::DollarCrate(crate_id); |
126 | } | ||
129 | } | 127 | } |
130 | } | 128 | } |
131 | } | 129 | } |
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index f2ea5088e..d68f1029f 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -423,6 +423,10 @@ impl ast::MacroCall { | |||
423 | None | 423 | None |
424 | } | 424 | } |
425 | } | 425 | } |
426 | |||
427 | pub fn is_bang(&self) -> bool { | ||
428 | self.is_macro_rules().is_none() | ||
429 | } | ||
426 | } | 430 | } |
427 | 431 | ||
428 | impl ast::LifetimeParam { | 432 | impl ast::LifetimeParam { |