aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/mock.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index 54260101c..9423e6571 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -2,12 +2,14 @@ use std::sync::Arc;
2 2
3use parking_lot::Mutex; 3use parking_lot::Mutex;
4use salsa::{self, Database}; 4use salsa::{self, Database};
5use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, WORKSPACE, CrateGraph, SourceRoot}; 5use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId};
6use relative_path::RelativePathBuf; 6use relative_path::RelativePathBuf;
7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; 7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
8 8
9use crate::{db, DefId, DefLoc}; 9use crate::{db, DefId, DefLoc};
10 10
11const WORKSPACE: SourceRootId = SourceRootId(0);
12
11#[derive(Debug)] 13#[derive(Debug)]
12pub(crate) struct MockDatabase { 14pub(crate) struct MockDatabase {
13 events: Mutex<Option<Vec<salsa::Event<MockDatabase>>>>, 15 events: Mutex<Option<Vec<salsa::Event<MockDatabase>>>>,
@@ -106,11 +108,11 @@ impl Default for MockDatabase {
106 runtime: salsa::Runtime::default(), 108 runtime: salsa::Runtime::default(),
107 id_maps: Default::default(), 109 id_maps: Default::default(),
108 }; 110 };
109 db.query_mut(ra_db::SourceRootQuery)
110 .set(ra_db::WORKSPACE, Default::default());
111 db.query_mut(ra_db::CrateGraphQuery) 111 db.query_mut(ra_db::CrateGraphQuery)
112 .set((), Default::default()); 112 .set((), Default::default());
113 db.query_mut(ra_db::LibrariesQuery) 113 db.query_mut(ra_db::LocalRootsQuery)
114 .set((), Default::default());
115 db.query_mut(ra_db::LibraryRootsQuery)
114 .set((), Default::default()); 116 .set((), Default::default());
115 db 117 db
116 } 118 }
@@ -163,7 +165,8 @@ salsa::database_storage! {
163 fn file_relative_path() for ra_db::FileRelativePathQuery; 165 fn file_relative_path() for ra_db::FileRelativePathQuery;
164 fn file_source_root() for ra_db::FileSourceRootQuery; 166 fn file_source_root() for ra_db::FileSourceRootQuery;
165 fn source_root() for ra_db::SourceRootQuery; 167 fn source_root() for ra_db::SourceRootQuery;
166 fn libraries() for ra_db::LibrariesQuery; 168 fn local_roots() for ra_db::LocalRootsQuery;
169 fn library_roots() for ra_db::LibraryRootsQuery;
167 fn crate_graph() for ra_db::CrateGraphQuery; 170 fn crate_graph() for ra_db::CrateGraphQuery;
168 } 171 }
169 impl ra_db::SyntaxDatabase { 172 impl ra_db::SyntaxDatabase {