aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/mod_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres/mod_resolution.rs')
-rw-r--r--crates/ra_hir/src/nameres/mod_resolution.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/crates/ra_hir/src/nameres/mod_resolution.rs b/crates/ra_hir/src/nameres/mod_resolution.rs
index 94c9946ff..de81fd422 100644
--- a/crates/ra_hir/src/nameres/mod_resolution.rs
+++ b/crates/ra_hir/src/nameres/mod_resolution.rs
@@ -120,10 +120,12 @@ enum OutOfLineMode {
120impl OutOfLineMode { 120impl OutOfLineMode {
121 pub fn resolve(&self, source_root: Arc<SourceRoot>) -> Result<FileId, RelativePathBuf> { 121 pub fn resolve(&self, source_root: Arc<SourceRoot>) -> Result<FileId, RelativePathBuf> {
122 match self { 122 match self {
123 OutOfLineMode::RootOrModRs { file, directory } => match source_root.files.get(file) { 123 OutOfLineMode::RootOrModRs { file, directory } => {
124 None => resolve_simple_path(source_root, directory).map_err(|_| file.clone()), 124 match source_root.file_by_relative_path(file) {
125 file_id => resolve_find_result(file_id, file), 125 None => resolve_simple_path(source_root, directory).map_err(|_| file.clone()),
126 }, 126 file_id => resolve_find_result(file_id, file),
127 }
128 }
127 OutOfLineMode::FileInDirectory(path) => resolve_simple_path(source_root, path), 129 OutOfLineMode::FileInDirectory(path) => resolve_simple_path(source_root, path),
128 OutOfLineMode::WithAttributePath(path) => resolve_simple_path(source_root, path), 130 OutOfLineMode::WithAttributePath(path) => resolve_simple_path(source_root, path),
129 } 131 }
@@ -168,11 +170,11 @@ fn resolve_simple_path(
168 source_root: Arc<SourceRoot>, 170 source_root: Arc<SourceRoot>,
169 path: &RelativePathBuf, 171 path: &RelativePathBuf,
170) -> Result<FileId, RelativePathBuf> { 172) -> Result<FileId, RelativePathBuf> {
171 resolve_find_result(source_root.files.get(path), path) 173 resolve_find_result(source_root.file_by_relative_path(path), path)
172} 174}
173 175
174fn resolve_find_result( 176fn resolve_find_result(
175 file_id: Option<&FileId>, 177 file_id: Option<FileId>,
176 path: &RelativePathBuf, 178 path: &RelativePathBuf,
177) -> Result<FileId, RelativePathBuf> { 179) -> Result<FileId, RelativePathBuf> {
178 match file_id { 180 match file_id {