diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/nameres/mod_resolution.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/hir_def/src/nameres/mod_resolution.rs b/crates/hir_def/src/nameres/mod_resolution.rs index d5de9899c..afb06fd82 100644 --- a/crates/hir_def/src/nameres/mod_resolution.rs +++ b/crates/hir_def/src/nameres/mod_resolution.rs | |||
@@ -62,6 +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 file_id = file_id.original_file(db.upcast()); | 66 | let file_id = file_id.original_file(db.upcast()); |
66 | 67 | ||
67 | let mut candidate_files = Vec::new(); | 68 | let mut candidate_files = Vec::new(); |
@@ -70,8 +71,13 @@ impl ModDir { | |||
70 | candidate_files.push(self.dir_path.join_attr(attr_path, self.root_non_dir_owner)) | 71 | candidate_files.push(self.dir_path.join_attr(attr_path, self.root_non_dir_owner)) |
71 | } | 72 | } |
72 | None => { | 73 | None => { |
73 | candidate_files.push(format!("{}{}.rs", self.dir_path.0, name)); | 74 | if is_include_macro { |
74 | candidate_files.push(format!("{}{}/mod.rs", self.dir_path.0, name)); | 75 | candidate_files.push(format!("{}.rs", name)); |
76 | candidate_files.push(format!("{}/mod.rs", name)); | ||
77 | } else { | ||
78 | candidate_files.push(format!("{}{}.rs", self.dir_path.0, name)); | ||
79 | candidate_files.push(format!("{}{}/mod.rs", self.dir_path.0, name)); | ||
80 | } | ||
75 | } | 81 | } |
76 | }; | 82 | }; |
77 | 83 | ||