diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_def/src/nameres/mod_resolution.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/hir_def/src/nameres/mod_resolution.rs b/crates/hir_def/src/nameres/mod_resolution.rs index afb06fd82..d9cec0e27 100644 --- a/crates/hir_def/src/nameres/mod_resolution.rs +++ b/crates/hir_def/src/nameres/mod_resolution.rs | |||
@@ -62,8 +62,7 @@ impl ModDir { | |||
62 | name: &Name, | 62 | name: &Name, |
63 | attr_path: Option<&SmolStr>, | 63 | attr_path: Option<&SmolStr>, |
64 | ) -> Result<(FileId, bool, ModDir), String> { | 64 | ) -> Result<(FileId, bool, ModDir), String> { |
65 | let is_include_macro = file_id.is_include_macro(db.upcast()); | 65 | let orig_file_id = file_id.original_file(db.upcast()); |
66 | let file_id = file_id.original_file(db.upcast()); | ||
67 | 66 | ||
68 | let mut candidate_files = Vec::new(); | 67 | let mut candidate_files = Vec::new(); |
69 | match attr_path { | 68 | match attr_path { |
@@ -71,7 +70,7 @@ impl ModDir { | |||
71 | candidate_files.push(self.dir_path.join_attr(attr_path, self.root_non_dir_owner)) | 70 | candidate_files.push(self.dir_path.join_attr(attr_path, self.root_non_dir_owner)) |
72 | } | 71 | } |
73 | None => { | 72 | None => { |
74 | if is_include_macro { | 73 | if file_id.is_include_macro(db.upcast()) { |
75 | candidate_files.push(format!("{}.rs", name)); | 74 | candidate_files.push(format!("{}.rs", name)); |
76 | candidate_files.push(format!("{}/mod.rs", name)); | 75 | candidate_files.push(format!("{}/mod.rs", name)); |
77 | } else { | 76 | } else { |
@@ -82,7 +81,7 @@ impl ModDir { | |||
82 | }; | 81 | }; |
83 | 82 | ||
84 | for candidate in candidate_files.iter() { | 83 | for candidate in candidate_files.iter() { |
85 | let path = AnchoredPath { anchor: file_id, path: candidate.as_str() }; | 84 | let path = AnchoredPath { anchor: orig_file_id, path: candidate.as_str() }; |
86 | if let Some(file_id) = db.resolve_path(path) { | 85 | if let Some(file_id) = db.resolve_path(path) { |
87 | let is_mod_rs = candidate.ends_with("/mod.rs"); | 86 | let is_mod_rs = candidate.ends_with("/mod.rs"); |
88 | 87 | ||