aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-12-09 16:01:15 +0000
committerAleksey Kladov <[email protected]>2020-12-09 16:07:05 +0000
commit6e24321e4579d25686982002ed18f321db23cb9f (patch)
tree08f0fd7d99ad22a3d1db782482b66548e99ba8b2 /crates/hir_ty
parent5e3891c2559de5a6540d69bc14ded281484479f9 (diff)
Introduce anchored_path
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;` in a lossless cross-platform & network-transparent way.
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/test_db.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/hir_ty/src/test_db.rs b/crates/hir_ty/src/test_db.rs
index 22254b765..646e16bbe 100644
--- a/crates/hir_ty/src/test_db.rs
+++ b/crates/hir_ty/src/test_db.rs
@@ -5,7 +5,9 @@ use std::{
5 sync::{Arc, Mutex}, 5 sync::{Arc, Mutex},
6}; 6};
7 7
8use base_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast}; 8use base_db::{
9 salsa, AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast,
10};
9use hir_def::{db::DefDatabase, ModuleId}; 11use hir_def::{db::DefDatabase, ModuleId};
10use hir_expand::db::AstDatabase; 12use hir_expand::db::AstDatabase;
11use rustc_hash::{FxHashMap, FxHashSet}; 13use rustc_hash::{FxHashMap, FxHashSet};
@@ -67,8 +69,8 @@ impl FileLoader for TestDB {
67 fn file_text(&self, file_id: FileId) -> Arc<String> { 69 fn file_text(&self, file_id: FileId) -> Arc<String> {
68 FileLoaderDelegate(self).file_text(file_id) 70 FileLoaderDelegate(self).file_text(file_id)
69 } 71 }
70 fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { 72 fn resolve_path(&self, path: AnchoredPath) -> Option<FileId> {
71 FileLoaderDelegate(self).resolve_path(anchor, path) 73 FileLoaderDelegate(self).resolve_path(path)
72 } 74 }
73 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> { 75 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
74 FileLoaderDelegate(self).relevant_crates(file_id) 76 FileLoaderDelegate(self).relevant_crates(file_id)