From 131c2da6bfd8ad6a25a55b4c85081da327ba2acb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 26 Nov 2019 11:29:20 +0300 Subject: :arrow_up: salsa --- crates/ra_assists/src/test_db.rs | 3 +++ crates/ra_cli/src/analysis_bench.rs | 4 ++-- crates/ra_db/Cargo.toml | 2 +- crates/ra_hir/src/test_db.rs | 4 ++++ crates/ra_hir_def/src/test_db.rs | 4 +++- crates/ra_hir_expand/src/test_db.rs | 4 ++++ crates/ra_ide_api/src/change.rs | 2 +- crates/ra_ide_api/src/db.rs | 3 +++ 8 files changed, 21 insertions(+), 5 deletions(-) (limited to 'crates') 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 { fn salsa_runtime(&self) -> &salsa::Runtime { &self.runtime } + fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime { + &mut self.runtime + } } impl 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 T, T>(host: &mut AnalysisHost, file_id: FileId, w { let start = Instant::now(); eprint!("trivial change: "); - host.raw_database().salsa_runtime().synthetic_write(Durability::LOW); + host.raw_database_mut().salsa_runtime_mut().synthetic_write(Durability::LOW); work(&host.analysis()); eprintln!("{:?}", start.elapsed()); } @@ -111,7 +111,7 @@ fn do_work T, T>(host: &mut AnalysisHost, file_id: FileId, w { let start = Instant::now(); eprint!("const change: "); - host.raw_database().salsa_runtime().synthetic_write(Durability::HIGH); + host.raw_database_mut().salsa_runtime_mut().synthetic_write(Durability::HIGH); let res = work(&host.analysis()); eprintln!("{:?}", start.elapsed()); 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"] doctest = false [dependencies] -salsa = "0.13.0" +salsa = "0.14.1" relative-path = "1.0.0" rustc-hash = "1.0" 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 { &self.runtime } + fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime { + &mut self.runtime + } + fn salsa_event(&self, event: impl Fn() -> salsa::Event) { let mut events = self.events.lock(); 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 { fn salsa_runtime(&self) -> &salsa::Runtime { &self.runtime } - + fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime { + &mut self.runtime + } fn salsa_event(&self, event: impl Fn() -> salsa::Event) { let mut events = self.events.lock().unwrap(); 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 { &self.runtime } + fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime { + &mut self.runtime + } + fn salsa_event(&self, event: impl Fn() -> salsa::Event) { let mut events = self.events.lock().unwrap(); 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 { log::info!("apply_change {:?}", change); { let _p = profile("RootDatabase::apply_change/cancellation"); - self.salsa_runtime().synthetic_write(Durability::LOW); + self.salsa_runtime_mut().synthetic_write(Durability::LOW); } if !change.new_roots.is_empty() { 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 { fn salsa_runtime(&self) -> &salsa::Runtime { &self.runtime } + fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime { + &mut self.runtime + } fn on_propagated_panic(&self) -> ! { Canceled::throw() } -- cgit v1.2.3