aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-26 08:29:20 +0000
committerAleksey Kladov <[email protected]>2019-11-26 08:29:20 +0000
commit131c2da6bfd8ad6a25a55b4c85081da327ba2acb (patch)
treed05b34483333fd1abfe95679cd37a6a837c468ff /crates
parent58a3b3b502580e9f49dcfc9b7223e8aec258adf6 (diff)
:arrow_up: salsa
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/test_db.rs3
-rw-r--r--crates/ra_cli/src/analysis_bench.rs4
-rw-r--r--crates/ra_db/Cargo.toml2
-rw-r--r--crates/ra_hir/src/test_db.rs4
-rw-r--r--crates/ra_hir_def/src/test_db.rs4
-rw-r--r--crates/ra_hir_expand/src/test_db.rs4
-rw-r--r--crates/ra_ide_api/src/change.rs2
-rw-r--r--crates/ra_ide_api/src/db.rs3
8 files changed, 21 insertions, 5 deletions
diff --git a/crates/ra_assists/src/test_db.rs b/crates/ra_assists/src/test_db.rs
index 5f96c974b..523259fd4 100644
--- a/crates/ra_assists/src/test_db.rs
+++ b/crates/ra_assists/src/test_db.rs
@@ -21,6 +21,9 @@ impl salsa::Database for TestDB {
21 fn salsa_runtime(&self) -> &salsa::Runtime<Self> { 21 fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
22 &self.runtime 22 &self.runtime
23 } 23 }
24 fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
25 &mut self.runtime
26 }
24} 27}
25 28
26impl std::panic::RefUnwindSafe for TestDB {} 29impl std::panic::RefUnwindSafe for TestDB {}
diff --git a/crates/ra_cli/src/analysis_bench.rs b/crates/ra_cli/src/analysis_bench.rs
index 8bbe5d9e8..34105af57 100644
--- a/crates/ra_cli/src/analysis_bench.rs
+++ b/crates/ra_cli/src/analysis_bench.rs
@@ -91,7 +91,7 @@ fn do_work<F: Fn(&Analysis) -> T, T>(host: &mut AnalysisHost, file_id: FileId, w
91 { 91 {
92 let start = Instant::now(); 92 let start = Instant::now();
93 eprint!("trivial change: "); 93 eprint!("trivial change: ");
94 host.raw_database().salsa_runtime().synthetic_write(Durability::LOW); 94 host.raw_database_mut().salsa_runtime_mut().synthetic_write(Durability::LOW);
95 work(&host.analysis()); 95 work(&host.analysis());
96 eprintln!("{:?}", start.elapsed()); 96 eprintln!("{:?}", start.elapsed());
97 } 97 }
@@ -111,7 +111,7 @@ fn do_work<F: Fn(&Analysis) -> T, T>(host: &mut AnalysisHost, file_id: FileId, w
111 { 111 {
112 let start = Instant::now(); 112 let start = Instant::now();
113 eprint!("const change: "); 113 eprint!("const change: ");
114 host.raw_database().salsa_runtime().synthetic_write(Durability::HIGH); 114 host.raw_database_mut().salsa_runtime_mut().synthetic_write(Durability::HIGH);
115 let res = work(&host.analysis()); 115 let res = work(&host.analysis());
116 eprintln!("{:?}", start.elapsed()); 116 eprintln!("{:?}", start.elapsed());
117 res 117 res
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml
index 4ec09b6d9..7afa5d8fc 100644
--- a/crates/ra_db/Cargo.toml
+++ b/crates/ra_db/Cargo.toml
@@ -8,7 +8,7 @@ authors = ["rust-analyzer developers"]
8doctest = false 8doctest = false
9 9
10[dependencies] 10[dependencies]
11salsa = "0.13.0" 11salsa = "0.14.1"
12relative-path = "1.0.0" 12relative-path = "1.0.0"
13rustc-hash = "1.0" 13rustc-hash = "1.0"
14 14
diff --git a/crates/ra_hir/src/test_db.rs b/crates/ra_hir/src/test_db.rs
index efee2f658..a2071f71c 100644
--- a/crates/ra_hir/src/test_db.rs
+++ b/crates/ra_hir/src/test_db.rs
@@ -28,6 +28,10 @@ impl salsa::Database for TestDB {
28 &self.runtime 28 &self.runtime
29 } 29 }
30 30
31 fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
32 &mut self.runtime
33 }
34
31 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) { 35 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
32 let mut events = self.events.lock(); 36 let mut events = self.events.lock();
33 if let Some(events) = &mut *events { 37 if let Some(events) = &mut *events {
diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs
index 439e8a412..54e3a84bd 100644
--- a/crates/ra_hir_def/src/test_db.rs
+++ b/crates/ra_hir_def/src/test_db.rs
@@ -24,7 +24,9 @@ impl salsa::Database for TestDB {
24 fn salsa_runtime(&self) -> &salsa::Runtime<Self> { 24 fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
25 &self.runtime 25 &self.runtime
26 } 26 }
27 27 fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
28 &mut self.runtime
29 }
28 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) { 30 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
29 let mut events = self.events.lock().unwrap(); 31 let mut events = self.events.lock().unwrap();
30 if let Some(events) = &mut *events { 32 if let Some(events) = &mut *events {
diff --git a/crates/ra_hir_expand/src/test_db.rs b/crates/ra_hir_expand/src/test_db.rs
index d23e75d9e..918736e2a 100644
--- a/crates/ra_hir_expand/src/test_db.rs
+++ b/crates/ra_hir_expand/src/test_db.rs
@@ -23,6 +23,10 @@ impl salsa::Database for TestDB {
23 &self.runtime 23 &self.runtime
24 } 24 }
25 25
26 fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
27 &mut self.runtime
28 }
29
26 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) { 30 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
27 let mut events = self.events.lock().unwrap(); 31 let mut events = self.events.lock().unwrap();
28 if let Some(events) = &mut *events { 32 if let Some(events) = &mut *events {
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index 0f692460d..84340aff8 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -171,7 +171,7 @@ impl RootDatabase {
171 log::info!("apply_change {:?}", change); 171 log::info!("apply_change {:?}", change);
172 { 172 {
173 let _p = profile("RootDatabase::apply_change/cancellation"); 173 let _p = profile("RootDatabase::apply_change/cancellation");
174 self.salsa_runtime().synthetic_write(Durability::LOW); 174 self.salsa_runtime_mut().synthetic_write(Durability::LOW);
175 } 175 }
176 if !change.new_roots.is_empty() { 176 if !change.new_roots.is_empty() {
177 let mut local_roots = Vec::clone(&self.local_roots()); 177 let mut local_roots = Vec::clone(&self.local_roots());
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index c2a9dcdd1..f739ebecd 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -65,6 +65,9 @@ impl salsa::Database for RootDatabase {
65 fn salsa_runtime(&self) -> &salsa::Runtime<RootDatabase> { 65 fn salsa_runtime(&self) -> &salsa::Runtime<RootDatabase> {
66 &self.runtime 66 &self.runtime
67 } 67 }
68 fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
69 &mut self.runtime
70 }
68 fn on_propagated_panic(&self) -> ! { 71 fn on_propagated_panic(&self) -> ! {
69 Canceled::throw() 72 Canceled::throw()
70 } 73 }