aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_batch
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-09 20:51:22 +0100
committerAleksey Kladov <[email protected]>2019-04-09 20:51:22 +0100
commit6b993a97602da5ddee4033d4d76a68471f8d1ee1 (patch)
tree7789a282bbdf26119e3a05370040c3e14bdadc1b /crates/ra_batch
parent2fc2d4373b2c4e96bebf320a84270eee3afe34aa (diff)
migrate to salsas interning
Diffstat (limited to 'crates/ra_batch')
-rw-r--r--crates/ra_batch/src/lib.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index 5bb47afb2..0cafe617d 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -9,7 +9,7 @@ use rustc_hash::FxHashMap;
9use ra_db::{ 9use ra_db::{
10 CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa, 10 CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa,
11}; 11};
12use ra_hir::{db, HirInterner}; 12use ra_hir::db;
13use ra_project_model::ProjectWorkspace; 13use ra_project_model::ProjectWorkspace;
14use ra_vfs::{Vfs, VfsChange}; 14use ra_vfs::{Vfs, VfsChange};
15use vfs_filter::IncludeRustFiles; 15use vfs_filter::IncludeRustFiles;
@@ -20,7 +20,6 @@ type Result<T> = std::result::Result<T, failure::Error>;
20#[derive(Debug)] 20#[derive(Debug)]
21pub struct BatchDatabase { 21pub struct BatchDatabase {
22 runtime: salsa::Runtime<BatchDatabase>, 22 runtime: salsa::Runtime<BatchDatabase>,
23 interner: Arc<HirInterner>,
24} 23}
25 24
26impl salsa::Database for BatchDatabase { 25impl salsa::Database for BatchDatabase {
@@ -29,12 +28,6 @@ impl salsa::Database for BatchDatabase {
29 } 28 }
30} 29}
31 30
32impl AsRef<HirInterner> for BatchDatabase {
33 fn as_ref(&self) -> &HirInterner {
34 &self.interner
35 }
36}
37
38fn vfs_file_to_id(f: ra_vfs::VfsFile) -> FileId { 31fn vfs_file_to_id(f: ra_vfs::VfsFile) -> FileId {
39 FileId(f.0.into()) 32 FileId(f.0.into())
40} 33}
@@ -44,8 +37,7 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
44 37
45impl BatchDatabase { 38impl BatchDatabase {
46 pub fn load(crate_graph: CrateGraph, vfs: &mut Vfs) -> BatchDatabase { 39 pub fn load(crate_graph: CrateGraph, vfs: &mut Vfs) -> BatchDatabase {
47 let mut db = 40 let mut db = BatchDatabase { runtime: salsa::Runtime::default() };
48 BatchDatabase { runtime: salsa::Runtime::default(), interner: Default::default() };
49 db.set_crate_graph(Arc::new(crate_graph)); 41 db.set_crate_graph(Arc::new(crate_graph));
50 42
51 // wait until Vfs has loaded all roots 43 // wait until Vfs has loaded all roots