diff options
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/source_analyzer.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index 5a3d80e8e..3f940124c 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs | |||
@@ -289,7 +289,7 @@ impl SourceAnalyzer { | |||
289 | let ctx = body::LowerCtx::with_hygiene(db.upcast(), &hygiene); | 289 | let ctx = body::LowerCtx::with_hygiene(db.upcast(), &hygiene); |
290 | let hir_path = Path::from_src(path.clone(), &ctx)?; | 290 | let hir_path = Path::from_src(path.clone(), &ctx)?; |
291 | 291 | ||
292 | // Case where path is a qualifier of another path, e.g. foo::bar::Baz where we | 292 | // Case where path is a qualifier of another path, e.g. foo::bar::Baz where we are |
293 | // trying to resolve foo::bar. | 293 | // trying to resolve foo::bar. |
294 | if let Some(outer_path) = parent().and_then(ast::Path::cast) { | 294 | if let Some(outer_path) = parent().and_then(ast::Path::cast) { |
295 | if let Some(qualifier) = outer_path.qualifier() { | 295 | if let Some(qualifier) = outer_path.qualifier() { |
@@ -298,6 +298,15 @@ impl SourceAnalyzer { | |||
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | // Case where path is a qualifier of a use tree, e.g. foo::bar::{Baz, Qux} where we are | ||
302 | // trying to resolve foo::bar. | ||
303 | if let Some(use_tree) = parent().and_then(ast::UseTree::cast) { | ||
304 | if let Some(qualifier) = use_tree.path() { | ||
305 | if path == &qualifier && use_tree.coloncolon_token().is_some() { | ||
306 | return resolve_hir_path_qualifier(db, &self.resolver, &hir_path); | ||
307 | } | ||
308 | } | ||
309 | } | ||
301 | 310 | ||
302 | resolve_hir_path_(db, &self.resolver, &hir_path, prefer_value_ns) | 311 | resolve_hir_path_(db, &self.resolver, &hir_path, prefer_value_ns) |
303 | } | 312 | } |