diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-22 13:17:21 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-22 13:17:21 +0100 |
commit | 0a612fad026df7c270226822e239f8d3137cf31c (patch) | |
tree | e14c62250a13f39860965b15d4e3d7e48d022d67 /crates/ra_ide_api/src/db.rs | |
parent | 2d0931b9ba7aabdc634c799b32957cc6f057e875 (diff) | |
parent | 69bbe79c5037eb3cd00744593d1836e45a6f56e1 (diff) |
Merge #1715
1715: Feature flags r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/db.rs')
-rw-r--r-- | crates/ra_ide_api/src/db.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index fc8252e4b..f2e6b8f12 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs | |||
@@ -7,7 +7,7 @@ use ra_db::{ | |||
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | symbol_index::{self, SymbolsDatabase}, | 9 | symbol_index::{self, SymbolsDatabase}, |
10 | LineIndex, | 10 | FeatureFlags, LineIndex, |
11 | }; | 11 | }; |
12 | 12 | ||
13 | #[salsa::database( | 13 | #[salsa::database( |
@@ -22,6 +22,7 @@ use crate::{ | |||
22 | #[derive(Debug)] | 22 | #[derive(Debug)] |
23 | pub(crate) struct RootDatabase { | 23 | pub(crate) struct RootDatabase { |
24 | runtime: salsa::Runtime<RootDatabase>, | 24 | runtime: salsa::Runtime<RootDatabase>, |
25 | pub(crate) feature_flags: Arc<FeatureFlags>, | ||
25 | pub(crate) last_gc: time::Instant, | 26 | pub(crate) last_gc: time::Instant, |
26 | pub(crate) last_gc_check: time::Instant, | 27 | pub(crate) last_gc_check: time::Instant, |
27 | } | 28 | } |
@@ -46,16 +47,17 @@ impl salsa::Database for RootDatabase { | |||
46 | 47 | ||
47 | impl Default for RootDatabase { | 48 | impl Default for RootDatabase { |
48 | fn default() -> RootDatabase { | 49 | fn default() -> RootDatabase { |
49 | RootDatabase::new(None) | 50 | RootDatabase::new(None, FeatureFlags::default()) |
50 | } | 51 | } |
51 | } | 52 | } |
52 | 53 | ||
53 | impl RootDatabase { | 54 | impl RootDatabase { |
54 | pub fn new(lru_capacity: Option<usize>) -> RootDatabase { | 55 | pub fn new(lru_capacity: Option<usize>, feature_flags: FeatureFlags) -> RootDatabase { |
55 | let mut db = RootDatabase { | 56 | let mut db = RootDatabase { |
56 | runtime: salsa::Runtime::default(), | 57 | runtime: salsa::Runtime::default(), |
57 | last_gc: time::Instant::now(), | 58 | last_gc: time::Instant::now(), |
58 | last_gc_check: time::Instant::now(), | 59 | last_gc_check: time::Instant::now(), |
60 | feature_flags: Arc::new(feature_flags), | ||
59 | }; | 61 | }; |
60 | db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); | 62 | db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); |
61 | db.set_local_roots_with_durability(Default::default(), Durability::HIGH); | 63 | db.set_local_roots_with_durability(Default::default(), Durability::HIGH); |
@@ -74,6 +76,7 @@ impl salsa::ParallelDatabase for RootDatabase { | |||
74 | runtime: self.runtime.snapshot(self), | 76 | runtime: self.runtime.snapshot(self), |
75 | last_gc: self.last_gc, | 77 | last_gc: self.last_gc, |
76 | last_gc_check: self.last_gc_check, | 78 | last_gc_check: self.last_gc_check, |
79 | feature_flags: Arc::clone(&self.feature_flags), | ||
77 | }) | 80 | }) |
78 | } | 81 | } |
79 | } | 82 | } |