From 3c72fc05738b8a08dbf90dab18a15b9894d9e2a1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 16 Jun 2020 18:45:58 +0200 Subject: Anchor file-system operations to the file, and not to the source root. Anchoring to the SourceRoot wont' work if the path is absolute: #[path = "/tmp/foo.rs"] mod foo; Anchoring to a file will. However, we *should* anchor, instead of just producing an abs path. I can imagine a situation where, for example, rust-analyzer processes crates from different machines (or, for example, from in-memory git branch), where the same absolute path in different crates might refer to different files in the end! --- crates/ra_hir_def/src/nameres.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/nameres.rs') diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index f279c2ad4..b3e5f491a 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs @@ -296,7 +296,6 @@ pub enum ModuleSource { mod diagnostics { use hir_expand::diagnostics::DiagnosticSink; - use ra_db::RelativePathBuf; use ra_syntax::{ast, AstPtr}; use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::LocalModuleId, AstId}; @@ -306,7 +305,7 @@ mod diagnostics { UnresolvedModule { module: LocalModuleId, declaration: AstId, - candidate: RelativePathBuf, + candidate: String, }, } -- cgit v1.2.3