aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/path_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres/path_resolution.rs')
-rw-r--r--crates/hir_def/src/nameres/path_resolution.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs
index 82528b792..7b5fe24a7 100644
--- a/crates/hir_def/src/nameres/path_resolution.rs
+++ b/crates/hir_def/src/nameres/path_resolution.rs
@@ -13,6 +13,7 @@
13use std::iter::successors; 13use std::iter::successors;
14 14
15use base_db::Edition; 15use base_db::Edition;
16use hir_expand::name;
16use hir_expand::name::Name; 17use hir_expand::name::Name;
17use test_utils::mark; 18use test_utils::mark;
18 19
@@ -63,6 +64,13 @@ impl ResolvePathResult {
63 64
64impl DefMap { 65impl DefMap {
65 pub(super) fn resolve_name_in_extern_prelude(&self, name: &Name) -> PerNs { 66 pub(super) fn resolve_name_in_extern_prelude(&self, name: &Name) -> PerNs {
67 if name == &name!(self) {
68 mark::hit!(extern_crate_self_as);
69 return PerNs::types(
70 ModuleId { krate: self.krate, local_id: self.root }.into(),
71 Visibility::Public,
72 );
73 }
66 self.extern_prelude 74 self.extern_prelude
67 .get(name) 75 .get(name)
68 .map_or(PerNs::none(), |&it| PerNs::types(it, Visibility::Public)) 76 .map_or(PerNs::none(), |&it| PerNs::types(it, Visibility::Public))