Skip to content

Commit 23ef13d

Browse files
committed
Auto merge of rust-lang#18239 - davidbarsky:davidbarsky/push-lswkwuyrpuqv, r=davidbarsky
chore: rename `salsa` to `ra_salsa` Laying some groundwork to start before I import the new Salsa crate. Here's why: 1. As part of the migration, `@darichey,` `@Wilfred,` and I will create new Salsa equivalents of the existing databases/query groups. We'll get them to compile crate-by-crate. 2. Once we wrote all equivalents of all queries, we'd start to refactor usage sites of the vendored Salsa to use the new Salsa databases. 3. Starting porting usage sites of old Salsa to the new Salsa. 4. Remove the vendored `ra_salsa`; declare victory.
2 parents 1a354f6 + d28811b commit 23ef13d

Some content is hidden

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

104 files changed

+540
-538
lines changed

src/tools/rust-analyzer/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ rustc-hash.opt-level = 3
2020
smol_str.opt-level = 3
2121
text-size.opt-level = 3
2222
serde.opt-level = 3
23-
salsa.opt-level = 3
23+
ra-salsa.opt-level = 3
2424
# This speeds up `cargo xtask dist`.
2525
miniz_oxide.opt-level = 3
2626

@@ -74,7 +74,7 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
7474
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
7575
profile = { path = "./crates/profile", version = "0.0.0" }
7676
project-model = { path = "./crates/project-model", version = "0.0.0" }
77-
salsa = { path = "./crates/salsa", version = "0.0.0" }
77+
ra-salsa = { path = "./crates/ra-salsa", package = "salsa", version = "0.0.0" }
7878
span = { path = "./crates/span", version = "0.0.0" }
7979
stdx = { path = "./crates/stdx", version = "0.0.0" }
8080
syntax = { path = "./crates/syntax", version = "0.0.0" }

src/tools/rust-analyzer/crates/base-db/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ doctest = false
1616
lz4_flex = { version = "0.11", default-features = false }
1717

1818
la-arena.workspace = true
19-
salsa.workspace = true
19+
ra-salsa.workspace = true
2020
rustc-hash.workspace = true
2121
triomphe.workspace = true
2222
semver.workspace = true

src/tools/rust-analyzer/crates/base-db/src/change.rs

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

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

src/tools/rust-analyzer/crates/base-db/src/lib.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ mod input;
55

66
use std::panic;
77

8+
use ra_salsa::Durability;
89
use rustc_hash::FxHashMap;
9-
use salsa::Durability;
1010
use span::EditionedFileId;
1111
use syntax::{ast, Parse, SourceFile, SyntaxError};
1212
use triomphe::Arc;
@@ -20,19 +20,19 @@ pub use crate::{
2020
TargetLayoutLoadResult,
2121
},
2222
};
23-
pub use salsa::{self, Cancelled};
23+
pub use ra_salsa::{self, Cancelled};
2424
pub use vfs::{file_set::FileSet, AnchoredPath, AnchoredPathBuf, VfsPath};
2525

2626
pub use semver::{BuildMetadata, Prerelease, Version, VersionReq};
2727

2828
#[macro_export]
2929
macro_rules! impl_intern_key {
3030
($name:ident) => {
31-
impl $crate::salsa::InternKey for $name {
32-
fn from_intern_id(v: $crate::salsa::InternId) -> Self {
31+
impl $crate::ra_salsa::InternKey for $name {
32+
fn from_intern_id(v: $crate::ra_salsa::InternId) -> Self {
3333
$name(v)
3434
}
35-
fn as_intern_id(&self) -> $crate::salsa::InternId {
35+
fn as_intern_id(&self) -> $crate::ra_salsa::InternId {
3636
self.0
3737
}
3838
}
@@ -55,30 +55,30 @@ pub trait FileLoader {
5555

5656
/// Database which stores all significant input facts: source code and project
5757
/// model. Everything else in rust-analyzer is derived from these queries.
58-
#[salsa::query_group(SourceDatabaseStorage)]
58+
#[ra_salsa::query_group(SourceDatabaseStorage)]
5959
pub trait SourceDatabase: FileLoader + std::fmt::Debug {
60-
#[salsa::input]
60+
#[ra_salsa::input]
6161
fn compressed_file_text(&self, file_id: FileId) -> Arc<[u8]>;
6262

6363
/// Text of the file.
64-
#[salsa::lru]
64+
#[ra_salsa::lru]
6565
fn file_text(&self, file_id: FileId) -> Arc<str>;
6666

6767
/// Parses the file into the syntax tree.
68-
#[salsa::lru]
68+
#[ra_salsa::lru]
6969
fn parse(&self, file_id: EditionedFileId) -> Parse<ast::SourceFile>;
7070

7171
/// Returns the set of errors obtained from parsing the file including validation errors.
7272
fn parse_errors(&self, file_id: EditionedFileId) -> Option<Arc<[SyntaxError]>>;
7373

7474
/// The crate graph.
75-
#[salsa::input]
75+
#[ra_salsa::input]
7676
fn crate_graph(&self) -> Arc<CrateGraph>;
7777

78-
#[salsa::input]
78+
#[ra_salsa::input]
7979
fn crate_workspace_data(&self) -> Arc<FxHashMap<CrateId, Arc<CrateWorkspaceData>>>;
8080

81-
#[salsa::transparent]
81+
#[ra_salsa::transparent]
8282
fn toolchain_channel(&self, krate: CrateId) -> Option<ReleaseChannel>;
8383
}
8484

@@ -126,14 +126,14 @@ fn file_text(db: &dyn SourceDatabase, file_id: FileId) -> Arc<str> {
126126

127127
/// We don't want to give HIR knowledge of source roots, hence we extract these
128128
/// methods into a separate DB.
129-
#[salsa::query_group(SourceRootDatabaseStorage)]
129+
#[ra_salsa::query_group(SourceRootDatabaseStorage)]
130130
pub trait SourceRootDatabase: SourceDatabase {
131131
/// Path to a file, relative to the root of its source root.
132132
/// Source root of the file.
133-
#[salsa::input]
133+
#[ra_salsa::input]
134134
fn file_source_root(&self, file_id: FileId) -> SourceRootId;
135135
/// Contents of the source root.
136-
#[salsa::input]
136+
#[ra_salsa::input]
137137
fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;
138138

139139
/// Crates whose root fool is in `id`.

0 commit comments

Comments
 (0)