Skip to content

Commit cc1ef95

Browse files
bors[bot]matklad
andauthored
Merge #2407
2407: ⬆️ salsa r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 58a3b3b + 131c2da commit cc1ef95

File tree

9 files changed

+53
-25
lines changed

9 files changed

+53
-25
lines changed

Cargo.lock

Lines changed: 32 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_assists/src/test_db.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ impl salsa::Database for TestDB {
2121
fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
2222
&self.runtime
2323
}
24+
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
25+
&mut self.runtime
26+
}
2427
}
2528

2629
impl std::panic::RefUnwindSafe for TestDB {}

crates/ra_cli/src/analysis_bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn do_work<F: Fn(&Analysis) -> T, T>(host: &mut AnalysisHost, file_id: FileId, w
9191
{
9292
let start = Instant::now();
9393
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);
9595
work(&host.analysis());
9696
eprintln!("{:?}", start.elapsed());
9797
}
@@ -111,7 +111,7 @@ fn do_work<F: Fn(&Analysis) -> T, T>(host: &mut AnalysisHost, file_id: FileId, w
111111
{
112112
let start = Instant::now();
113113
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);
115115
let res = work(&host.analysis());
116116
eprintln!("{:?}", start.elapsed());
117117
res

crates/ra_db/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = ["rust-analyzer developers"]
88
doctest = false
99

1010
[dependencies]
11-
salsa = "0.13.0"
11+
salsa = "0.14.1"
1212
relative-path = "1.0.0"
1313
rustc-hash = "1.0"
1414

crates/ra_hir/src/test_db.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ impl salsa::Database for TestDB {
2828
&self.runtime
2929
}
3030

31+
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
32+
&mut self.runtime
33+
}
34+
3135
fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
3236
let mut events = self.events.lock();
3337
if let Some(events) = &mut *events {

crates/ra_hir_def/src/test_db.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ impl salsa::Database for TestDB {
2424
fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
2525
&self.runtime
2626
}
27-
27+
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
28+
&mut self.runtime
29+
}
2830
fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
2931
let mut events = self.events.lock().unwrap();
3032
if let Some(events) = &mut *events {

crates/ra_hir_expand/src/test_db.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ impl salsa::Database for TestDB {
2323
&self.runtime
2424
}
2525

26+
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
27+
&mut self.runtime
28+
}
29+
2630
fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
2731
let mut events = self.events.lock().unwrap();
2832
if let Some(events) = &mut *events {

crates/ra_ide_api/src/change.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl RootDatabase {
171171
log::info!("apply_change {:?}", change);
172172
{
173173
let _p = profile("RootDatabase::apply_change/cancellation");
174-
self.salsa_runtime().synthetic_write(Durability::LOW);
174+
self.salsa_runtime_mut().synthetic_write(Durability::LOW);
175175
}
176176
if !change.new_roots.is_empty() {
177177
let mut local_roots = Vec::clone(&self.local_roots());

crates/ra_ide_api/src/db.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ impl salsa::Database for RootDatabase {
6565
fn salsa_runtime(&self) -> &salsa::Runtime<RootDatabase> {
6666
&self.runtime
6767
}
68+
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
69+
&mut self.runtime
70+
}
6871
fn on_propagated_panic(&self) -> ! {
6972
Canceled::throw()
7073
}

0 commit comments

Comments
 (0)