Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/nameres/path_resolution.rs')
-rw-r--r--crates/hir-def/src/nameres/path_resolution.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/hir-def/src/nameres/path_resolution.rs b/crates/hir-def/src/nameres/path_resolution.rs
index 4c1b8f306c..7c3231913d 100644
--- a/crates/hir-def/src/nameres/path_resolution.rs
+++ b/crates/hir-def/src/nameres/path_resolution.rs
@@ -93,11 +93,15 @@ impl DefMap {
if remaining.is_some() {
return None;
}
- let types = result.take_types()?;
- match types {
- ModuleDefId::ModuleId(m) => Visibility::Module(m),
- _ => {
- // error: visibility needs to refer to module
+ let types = result.take_types();
+
+ match (types, path.kind) {
+ (Some(ModuleDefId::ModuleId(m)), _) => Visibility::Module(m),
+ // resolve_path doesn't find any values for a plan pathkind of a private function
+ (None, PathKind::Plain | PathKind::Crate) => {
+ Visibility::Module(self.module_id(original_module))
+ }
+ (_, _) => {
return None;
}
}