Update salsa (#19258)

## Summary

Pulls in https://github.com/salsa-rs/salsa/pull/934.
This commit is contained in:
Ibraheem Ahmed 2025-07-18 12:14:28 -04:00 committed by GitHub
parent 64f9481fd0
commit e6e029a8b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 69 additions and 26 deletions

37
Cargo.lock generated
View file

@ -1557,6 +1557,15 @@ dependencies = [
"memoffset", "memoffset",
] ]
[[package]]
name = "inventory"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab08d7cd2c5897f2c949e5383ea7c7db03fb19130ffcfbf7eda795137ae3cb83"
dependencies = [
"rustversion",
]
[[package]] [[package]]
name = "is-docker" name = "is-docker"
version = "0.2.0" version = "0.2.0"
@ -2123,16 +2132,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "papaya"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f92dd0b07c53a0a0c764db2ace8c541dc47320dad97c2200c2a637ab9dd2328f"
dependencies = [
"equivalent",
"seize",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.3" version = "0.12.3"
@ -3409,7 +3408,7 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]] [[package]]
name = "salsa" name = "salsa"
version = "0.23.0" version = "0.23.0"
source = "git+https://github.com/salsa-rs/salsa?rev=fc00eba89e5dcaa5edba51c41aa5f309b5cb126b#fc00eba89e5dcaa5edba51c41aa5f309b5cb126b" source = "git+https://github.com/salsa-rs/salsa?rev=dba66f1a37acca014c2402f231ed5b361bd7d8fe#dba66f1a37acca014c2402f231ed5b361bd7d8fe"
dependencies = [ dependencies = [
"boxcar", "boxcar",
"compact_str", "compact_str",
@ -3419,7 +3418,7 @@ dependencies = [
"hashlink", "hashlink",
"indexmap", "indexmap",
"intrusive-collections", "intrusive-collections",
"papaya", "inventory",
"parking_lot", "parking_lot",
"portable-atomic", "portable-atomic",
"rayon", "rayon",
@ -3434,12 +3433,12 @@ dependencies = [
[[package]] [[package]]
name = "salsa-macro-rules" name = "salsa-macro-rules"
version = "0.23.0" version = "0.23.0"
source = "git+https://github.com/salsa-rs/salsa?rev=fc00eba89e5dcaa5edba51c41aa5f309b5cb126b#fc00eba89e5dcaa5edba51c41aa5f309b5cb126b" source = "git+https://github.com/salsa-rs/salsa?rev=dba66f1a37acca014c2402f231ed5b361bd7d8fe#dba66f1a37acca014c2402f231ed5b361bd7d8fe"
[[package]] [[package]]
name = "salsa-macros" name = "salsa-macros"
version = "0.23.0" version = "0.23.0"
source = "git+https://github.com/salsa-rs/salsa?rev=fc00eba89e5dcaa5edba51c41aa5f309b5cb126b#fc00eba89e5dcaa5edba51c41aa5f309b5cb126b" source = "git+https://github.com/salsa-rs/salsa?rev=dba66f1a37acca014c2402f231ed5b361bd7d8fe#dba66f1a37acca014c2402f231ed5b361bd7d8fe"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3492,16 +3491,6 @@ version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "seize"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4b8d813387d566f627f3ea1b914c068aac94c40ae27ec43f5f33bde65abefe7"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.219" version = "1.0.219"

View file

@ -138,7 +138,7 @@ regex-automata = { version = "0.4.9" }
rustc-hash = { version = "2.0.0" } rustc-hash = { version = "2.0.0" }
rustc-stable-hash = { version = "0.1.2" } rustc-stable-hash = { version = "0.1.2" }
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml` # When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
salsa = { git = "https://github.com/salsa-rs/salsa", rev = "fc00eba89e5dcaa5edba51c41aa5f309b5cb126b" } salsa = { git = "https://github.com/salsa-rs/salsa", rev = "dba66f1a37acca014c2402f231ed5b361bd7d8fe" }
schemars = { version = "0.8.16" } schemars = { version = "0.8.16" }
seahash = { version = "4.1.0" } seahash = { version = "4.1.0" }
serde = { version = "1.0.197", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }

View file

@ -77,10 +77,31 @@ struct ExpandedEdit {
content: Option<String>, content: Option<String>,
} }
/// Perform global constructor initialization.
#[cfg(target_family = "wasm")]
#[expect(unsafe_code)]
pub fn before_main() {
unsafe extern "C" {
fn __wasm_call_ctors();
}
// Salsa uses the `inventory` crate, which registers global constructors that may need to be
// called explicitly on WASM. See <https://github.com/dtolnay/inventory/blob/master/src/lib.rs#L105>
// for details.
unsafe {
__wasm_call_ctors();
}
}
#[cfg(not(target_family = "wasm"))]
pub fn before_main() {}
#[wasm_bindgen(start)] #[wasm_bindgen(start)]
pub fn run() { pub fn run() {
use log::Level; use log::Level;
before_main();
// When the `console_error_panic_hook` feature is enabled, we can call the // When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then // `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics. // we will get better error messages if our code ever panics.

View file

@ -21,6 +21,8 @@ macro_rules! check {
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn empty_config() { fn empty_config() {
ruff_wasm::before_main();
check!( check!(
"if (1, 2):\n pass", "if (1, 2):\n pass",
r#"{}"#, r#"{}"#,
@ -42,6 +44,8 @@ fn empty_config() {
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn syntax_error() { fn syntax_error() {
ruff_wasm::before_main();
check!( check!(
"x =\ny = 1\n", "x =\ny = 1\n",
r#"{}"#, r#"{}"#,
@ -63,6 +67,8 @@ fn syntax_error() {
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn unsupported_syntax_error() { fn unsupported_syntax_error() {
ruff_wasm::before_main();
check!( check!(
"match 2:\n case 1: ...", "match 2:\n case 1: ...",
r#"{"target-version": "py39"}"#, r#"{"target-version": "py39"}"#,
@ -84,11 +90,15 @@ fn unsupported_syntax_error() {
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn partial_config() { fn partial_config() {
ruff_wasm::before_main();
check!("if (1, 2):\n pass", r#"{"ignore": ["F"]}"#, []); check!("if (1, 2):\n pass", r#"{"ignore": ["F"]}"#, []);
} }
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn partial_nested_config() { fn partial_nested_config() {
ruff_wasm::before_main();
let config = r#"{ let config = r#"{
"select": ["Q"], "select": ["Q"],
"flake8-quotes": { "flake8-quotes": {

View file

@ -32,10 +32,31 @@ pub fn version() -> String {
.to_string() .to_string()
} }
/// Perform global constructor initialization.
#[cfg(target_family = "wasm")]
#[expect(unsafe_code)]
pub fn before_main() {
unsafe extern "C" {
fn __wasm_call_ctors();
}
// Salsa uses the `inventory` crate, which registers global constructors that may need to be
// called explicitly on WASM. See <https://github.com/dtolnay/inventory/blob/master/src/lib.rs#L105>
// for details.
unsafe {
__wasm_call_ctors();
}
}
#[cfg(not(target_family = "wasm"))]
pub fn before_main() {}
#[wasm_bindgen(start)] #[wasm_bindgen(start)]
pub fn run() { pub fn run() {
use log::Level; use log::Level;
before_main();
ruff_db::set_program_version(version()).unwrap(); ruff_db::set_program_version(version()).unwrap();
// When the `console_error_panic_hook` feature is enabled, we can call the // When the `console_error_panic_hook` feature is enabled, we can call the

View file

@ -5,6 +5,8 @@ use wasm_bindgen_test::wasm_bindgen_test;
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn check() { fn check() {
ty_wasm::before_main();
let mut workspace = Workspace::new( let mut workspace = Workspace::new(
"/", "/",
PositionEncoding::Utf32, PositionEncoding::Utf32,

View file

@ -30,7 +30,7 @@ ty_python_semantic = { path = "../crates/ty_python_semantic" }
ty_vendored = { path = "../crates/ty_vendored" } ty_vendored = { path = "../crates/ty_vendored" }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer", default-features = false } libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer", default-features = false }
salsa = { git = "https://github.com/salsa-rs/salsa", rev = "fc00eba89e5dcaa5edba51c41aa5f309b5cb126b" } salsa = { git = "https://github.com/salsa-rs/salsa", rev = "dba66f1a37acca014c2402f231ed5b361bd7d8fe" }
similar = { version = "2.5.0" } similar = { version = "2.5.0" }
tracing = { version = "0.1.40" } tracing = { version = "0.1.40" }