diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-09 21:04:42 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-09 21:04:42 +0100 |
commit | b863272899a1bae63c7d9411d0ebff74652bae8e (patch) | |
tree | f5b95ae6af1ee37545eff70813c8940979e99daf /crates/ra_batch | |
parent | cc284dad30de4990516eeccf60f24e613fd78a2a (diff) | |
parent | 88189c428242d2d65b749d0980eb447e72766e77 (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')
-rw-r--r-- | crates/ra_batch/src/lib.rs | 12 |
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; | |||
9 | use ra_db::{ | 9 | use ra_db::{ |
10 | CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa, | 10 | CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa, |
11 | }; | 11 | }; |
12 | use ra_hir::{db, HirInterner}; | 12 | use ra_hir::db; |
13 | use ra_project_model::ProjectWorkspace; | 13 | use ra_project_model::ProjectWorkspace; |
14 | use ra_vfs::{Vfs, VfsChange}; | 14 | use ra_vfs::{Vfs, VfsChange}; |
15 | use vfs_filter::IncludeRustFiles; | 15 | use vfs_filter::IncludeRustFiles; |
@@ -20,7 +20,6 @@ type Result<T> = std::result::Result<T, failure::Error>; | |||
20 | #[derive(Debug)] | 20 | #[derive(Debug)] |
21 | pub struct BatchDatabase { | 21 | pub struct BatchDatabase { |
22 | runtime: salsa::Runtime<BatchDatabase>, | 22 | runtime: salsa::Runtime<BatchDatabase>, |
23 | interner: Arc<HirInterner>, | ||
24 | } | 23 | } |
25 | 24 | ||
26 | impl salsa::Database for BatchDatabase { | 25 | impl salsa::Database for BatchDatabase { |
@@ -29,12 +28,6 @@ impl salsa::Database for BatchDatabase { | |||
29 | } | 28 | } |
30 | } | 29 | } |
31 | 30 | ||
32 | impl AsRef<HirInterner> for BatchDatabase { | ||
33 | fn as_ref(&self) -> &HirInterner { | ||
34 | &self.interner | ||
35 | } | ||
36 | } | ||
37 | |||
38 | fn vfs_file_to_id(f: ra_vfs::VfsFile) -> FileId { | 31 | fn 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 | ||
45 | impl BatchDatabase { | 38 | impl 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 |