Skip to content

Commit 74620e6

Browse files
committed
internal: port rust-analyzer to new Salsa
1 parent 394374e commit 74620e6

File tree

161 files changed

+3042
-2298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+3042
-2298
lines changed

Cargo.lock

+578-277
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
7272
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
7373
profile = { path = "./crates/profile", version = "0.0.0" }
7474
project-model = { path = "./crates/project-model", version = "0.0.0" }
75-
ra-salsa = { path = "./crates/ra-salsa", package = "salsa", version = "0.0.0" }
75+
query-group = { package = "query-group-macro", path = "./crates/query-group-macro", version = "0.0.0" }
7676
span = { path = "./crates/span", version = "0.0.0" }
7777
stdx = { path = "./crates/stdx", version = "0.0.0" }
7878
syntax = { path = "./crates/syntax", version = "0.0.0" }
@@ -135,6 +135,7 @@ process-wrap = { version = "8.0.2", features = ["std"] }
135135
pulldown-cmark-to-cmark = "10.0.4"
136136
pulldown-cmark = { version = "0.9.0", default-features = false }
137137
rayon = "1.8.0"
138+
salsa = "0.19"
138139
rustc-hash = "2.0.0"
139140
semver = "1.0.14"
140141
serde = { version = "1.0.192" }

crates/base-db/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ rust-version.workspace = true
1515
lz4_flex = { version = "0.11", default-features = false }
1616

1717
la-arena.workspace = true
18-
ra-salsa.workspace = true
18+
dashmap.workspace = true
19+
salsa.workspace = true
20+
query-group.workspace = true
1921
rustc-hash.workspace = true
2022
triomphe.workspace = true
2123
semver.workspace = true

crates/base-db/src/change.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
44
use std::fmt;
55

6-
use ra_salsa::Durability;
76
use rustc_hash::FxHashMap;
7+
use salsa::Durability;
88
use triomphe::Arc;
99
use vfs::FileId;
1010

11-
use crate::{
12-
CrateGraph, CrateId, CrateWorkspaceData, SourceDatabaseFileInputExt, SourceRoot,
13-
SourceRootDatabase, SourceRootId,
14-
};
11+
use crate::{CrateGraph, CrateId, CrateWorkspaceData, RootQueryDb, SourceRoot, SourceRootId};
1512

1613
/// Encapsulate a bunch of raw `.set` calls on the database.
1714
#[derive(Default)]
@@ -59,7 +56,7 @@ impl FileChange {
5956
self.ws_data = Some(data);
6057
}
6158

62-
pub fn apply(self, db: &mut dyn SourceRootDatabase) {
59+
pub fn apply(self, db: &mut dyn RootQueryDb) {
6360
let _p = tracing::info_span!("FileChange::apply").entered();
6461
if let Some(roots) = self.roots {
6562
for (idx, root) in roots.into_iter().enumerate() {
@@ -68,14 +65,16 @@ impl FileChange {
6865
for file_id in root.iter() {
6966
db.set_file_source_root_with_durability(file_id, root_id, durability);
7067
}
68+
7169
db.set_source_root_with_durability(root_id, Arc::new(root), durability);
7270
}
7371
}
7472

7573
for (file_id, text) in self.files_changed {
7674
let source_root_id = db.file_source_root(file_id);
77-
let source_root = db.source_root(source_root_id);
78-
let durability = durability(&source_root);
75+
let source_root = db.source_root(source_root_id.source_root_id(db));
76+
77+
let durability = durability(&source_root.source_root(db));
7978
// XXX: can't actually remove the file, just reset the text
8079
let text = text.unwrap_or_default();
8180
db.set_file_text_with_durability(file_id, &text, durability)

0 commit comments

Comments
 (0)