aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/path_resolution.rs
diff options
context:
space:
mode:
authorkazatsuyu <[email protected]>2021-01-22 13:28:45 +0000
committerkazatsuyu <[email protected]>2021-01-22 13:28:45 +0000
commite52589e3a72ed57d47956d16d90f4b15fc7408f0 (patch)
treec16f0615942094ac0e28ab3c8ef080833614c000 /crates/hir_def/src/nameres/path_resolution.rs
parent2472851ccf22762065670e1cf00a9c39db869aac (diff)
Fix error when using "extern crate self as"
Diffstat (limited to 'crates/hir_def/src/nameres/path_resolution.rs')
-rw-r--r--crates/hir_def/src/nameres/path_resolution.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs
index ec90f4e65..a6e0f64fc 100644
--- a/crates/hir_def/src/nameres/path_resolution.rs
+++ b/crates/hir_def/src/nameres/path_resolution.rs
@@ -14,6 +14,7 @@ use std::iter::successors;
14 14
15use base_db::Edition; 15use base_db::Edition;
16use hir_expand::name::Name; 16use hir_expand::name::Name;
17use hir_expand::name;
17use test_utils::mark; 18use test_utils::mark;
18 19
19use crate::{ 20use crate::{
@@ -63,6 +64,11 @@ 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 return PerNs::types(ModuleId { krate: self.krate, local_id: self.root }.into(),
69 Visibility::Public,
70 );
71 }
66 self.extern_prelude 72 self.extern_prelude
67 .get(name) 73 .get(name)
68 .map_or(PerNs::none(), |&it| PerNs::types(it, Visibility::Public)) 74 .map_or(PerNs::none(), |&it| PerNs::types(it, Visibility::Public))