aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_batch/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 21:04:42 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 21:04:42 +0100
commitb863272899a1bae63c7d9411d0ebff74652bae8e (patch)
treef5b95ae6af1ee37545eff70813c8940979e99daf /crates/ra_batch/src/lib.rs
parentcc284dad30de4990516eeccf60f24e613fd78a2a (diff)
parent88189c428242d2d65b749d0980eb447e72766e77 (diff)
Merge #1126
1126: Swithc to native salsa interning r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_batch/src/lib.rs')
-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