Skip to content

Commit

Permalink
chore: rename salsa to ra_salsa
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbarsky committed Oct 14, 2024
1 parent d764d87 commit d28811b
Show file tree
Hide file tree
Showing 104 changed files with 540 additions and 538 deletions.
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rustc-hash.opt-level = 3
smol_str.opt-level = 3
text-size.opt-level = 3
serde.opt-level = 3
salsa.opt-level = 3
ra-salsa.opt-level = 3
# This speeds up `cargo xtask dist`.
miniz_oxide.opt-level = 3

Expand Down Expand Up @@ -74,7 +74,7 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
profile = { path = "./crates/profile", version = "0.0.0" }
project-model = { path = "./crates/project-model", version = "0.0.0" }
salsa = { path = "./crates/salsa", version = "0.0.0" }
ra-salsa = { path = "./crates/ra-salsa", package = "salsa", version = "0.0.0" }
span = { path = "./crates/span", version = "0.0.0" }
stdx = { path = "./crates/stdx", version = "0.0.0" }
syntax = { path = "./crates/syntax", version = "0.0.0" }
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/base-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ doctest = false
lz4_flex = { version = "0.11", default-features = false }

la-arena.workspace = true
salsa.workspace = true
ra-salsa.workspace = true
rustc-hash.workspace = true
triomphe.workspace = true
semver.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/base-db/src/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use std::fmt;

use ra_salsa::Durability;
use rustc_hash::FxHashMap;
use salsa::Durability;
use triomphe::Arc;
use vfs::FileId;

Expand Down
30 changes: 15 additions & 15 deletions src/tools/rust-analyzer/crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ mod input;

use std::panic;

use ra_salsa::Durability;
use rustc_hash::FxHashMap;
use salsa::Durability;
use span::EditionedFileId;
use syntax::{ast, Parse, SourceFile, SyntaxError};
use triomphe::Arc;
Expand All @@ -20,19 +20,19 @@ pub use crate::{
TargetLayoutLoadResult,
},
};
pub use salsa::{self, Cancelled};
pub use ra_salsa::{self, Cancelled};
pub use vfs::{file_set::FileSet, AnchoredPath, AnchoredPathBuf, VfsPath};

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

#[macro_export]
macro_rules! impl_intern_key {
($name:ident) => {
impl $crate::salsa::InternKey for $name {
fn from_intern_id(v: $crate::salsa::InternId) -> Self {
impl $crate::ra_salsa::InternKey for $name {
fn from_intern_id(v: $crate::ra_salsa::InternId) -> Self {
$name(v)
}
fn as_intern_id(&self) -> $crate::salsa::InternId {
fn as_intern_id(&self) -> $crate::ra_salsa::InternId {
self.0
}
}
Expand All @@ -55,30 +55,30 @@ pub trait FileLoader {

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

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

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

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

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

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

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

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

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

/// Crates whose root fool is in `id`.
Expand Down
Loading

0 comments on commit d28811b

Please sign in to comment.