Skip to content

Commit 7e9be34

Browse files
authored
Merge pull request #20796 from ChayimFriedman2/bump-salsa
internal: Bump Salsa
2 parents faa1184 + c6ef51e commit 7e9be34

File tree

53 files changed

+771
-684
lines changed

Some content is hidden

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

53 files changed

+771
-684
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ rayon = "1.10.0"
137137
rowan = "=0.15.15"
138138
# Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
139139
# on impls without it
140-
salsa = { version = "0.23.0", default-features = true, features = [
140+
salsa = { version = "0.24.0", default-features = true, features = [
141141
"rayon",
142142
"salsa_unstable",
143143
"macros",
144144
] }
145-
salsa-macros = "0.23.0"
145+
salsa-macros = "0.24.0"
146146
semver = "1.0.26"
147147
serde = { version = "1.0.219" }
148148
serde_derive = { version = "1.0.219" }

crates/cfg/Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ intern.workspace = true
2323
[dev-dependencies]
2424
expect-test = "1.5.1"
2525
oorandom = "11.1.5"
26-
# We depend on both individually instead of using `features = ["derive"]` to microoptimize the
27-
# build graph: if the feature was enabled, syn would be built early on in the graph if `smolstr`
28-
# supports `arbitrary`. This way, we avoid feature unification.
29-
arbitrary = "1.4.1"
30-
derive_arbitrary = "1.4.1"
26+
arbitrary = { version = "1.4.1", features = ["derive"] }
3127

3228
# local deps
3329
syntax-bridge.workspace = true

crates/cfg/src/cfg_expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl fmt::Display for CfgAtom {
4747
}
4848

4949
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
50-
#[cfg_attr(test, derive(derive_arbitrary::Arbitrary))]
50+
#[cfg_attr(test, derive(arbitrary::Arbitrary))]
5151
pub enum CfgExpr {
5252
Invalid,
5353
Atom(CfgAtom),

crates/hir-def/src/test_db.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use base_db::{
77
SourceDatabase, SourceRoot, SourceRootId, SourceRootInput,
88
};
99
use hir_expand::{InFile, files::FilePosition};
10-
use salsa::{AsDynDatabase, Durability};
10+
use salsa::Durability;
1111
use span::FileId;
1212
use syntax::{AstNode, algo, ast};
1313
use triomphe::Arc;
@@ -303,8 +303,7 @@ impl TestDB {
303303
// This is pretty horrible, but `Debug` is the only way to inspect
304304
// QueryDescriptor at the moment.
305305
salsa::EventKind::WillExecute { database_key } => {
306-
let ingredient = self
307-
.as_dyn_database()
306+
let ingredient = (self as &dyn salsa::Database)
308307
.ingredient_debug_name(database_key.ingredient_index());
309308
Some(ingredient.to_string())
310309
}

crates/hir-ty/src/consteval/tests.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn check_fail(
3636
error: impl FnOnce(ConstEvalError<'_>) -> bool,
3737
) {
3838
let (db, file_id) = TestDB::with_single_file(ra_fixture);
39-
salsa::attach(&db, || match eval_goal(&db, file_id) {
39+
crate::attach_db(&db, || match eval_goal(&db, file_id) {
4040
Ok(_) => panic!("Expected fail, but it succeeded"),
4141
Err(e) => {
4242
assert!(error(simplify(e.clone())), "Actual error was: {}", pretty_print_err(e, &db))
@@ -79,7 +79,7 @@ fn check_answer(
7979
check: impl FnOnce(&[u8], &MemoryMap<'_>),
8080
) {
8181
let (db, file_ids) = TestDB::with_many_files(ra_fixture);
82-
salsa::attach(&db, || {
82+
crate::attach_db(&db, || {
8383
let file_id = *file_ids.last().unwrap();
8484
let r = match eval_goal(&db, file_id) {
8585
Ok(t) => t,
@@ -2506,8 +2506,10 @@ fn enums() {
25062506
const GOAL: E = E::A;
25072507
"#,
25082508
);
2509-
let r = eval_goal(&db, file_id).unwrap();
2510-
assert_eq!(try_const_usize(&db, &r), Some(1));
2509+
crate::attach_db(&db, || {
2510+
let r = eval_goal(&db, file_id).unwrap();
2511+
assert_eq!(try_const_usize(&db, &r), Some(1));
2512+
})
25112513
}
25122514

25132515
#[test]

crates/hir-ty/src/dyn_compatibility/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn check_dyn_compatibility<'a>(
5757
};
5858
let mut osvs = FxHashSet::default();
5959
let db = &db;
60-
salsa::attach(db, || {
60+
crate::attach_db(db, || {
6161
_ = dyn_compatibility_with_callback(db, trait_id, &mut |osv| {
6262
osvs.insert(match osv {
6363
DynCompatibilityViolation::SizedSelf => SizedSelf,

crates/hir-ty/src/infer/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ fn pointer_kind<'db>(
400400
Ok(Some(PointerKind::Thin))
401401
}
402402
}
403-
TyKind::Tuple(subst) => match subst.iter().last() {
403+
TyKind::Tuple(subst) => match subst.iter().next_back() {
404404
None => Ok(Some(PointerKind::Thin)),
405405
Some(ty) => pointer_kind(ty, ctx),
406406
},

crates/hir-ty/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ fn struct_tail_erasing_lifetimes<'a>(db: &'a dyn HirDatabase, pointee: Ty<'a>) -
385385
}
386386
}
387387
TyKind::Tuple(tys) => {
388-
if let Some(last_field_ty) = tys.iter().last() {
388+
if let Some(last_field_ty) = tys.iter().next_back() {
389389
struct_tail_erasing_lifetimes(db, last_field_ty)
390390
} else {
391391
pointee

crates/hir-ty/src/layout/tests.rs

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn eval_goal(
7979
Some(adt_or_type_alias_id)
8080
})
8181
.unwrap();
82-
salsa::attach(&db, || {
82+
crate::attach_db(&db, || {
8383
let interner = DbInterner::new_with(&db, None, None);
8484
let goal_ty = match adt_or_type_alias_id {
8585
Either::Left(adt_id) => crate::next_solver::Ty::new_adt(
@@ -112,29 +112,34 @@ fn eval_expr(
112112
);
113113

114114
let (db, file_id) = TestDB::with_single_file(&ra_fixture);
115-
let module_id = db.module_for_file(file_id.file_id(&db));
116-
let def_map = module_id.def_map(&db);
117-
let scope = &def_map[module_id.local_id].scope;
118-
let function_id = scope
119-
.declarations()
120-
.find_map(|x| match x {
121-
hir_def::ModuleDefId::FunctionId(x) => {
122-
let name =
123-
db.function_signature(x).name.display_no_db(file_id.edition(&db)).to_smolstr();
124-
(name == "main").then_some(x)
125-
}
126-
_ => None,
127-
})
128-
.unwrap();
129-
let hir_body = db.body(function_id.into());
130-
let b = hir_body
131-
.bindings()
132-
.find(|x| x.1.name.display_no_db(file_id.edition(&db)).to_smolstr() == "goal")
133-
.unwrap()
134-
.0;
135-
let infer = db.infer(function_id.into());
136-
let goal_ty = infer.type_of_binding[b];
137-
salsa::attach(&db, || db.layout_of_ty(goal_ty, db.trait_environment(function_id.into())))
115+
crate::attach_db(&db, || {
116+
let module_id = db.module_for_file(file_id.file_id(&db));
117+
let def_map = module_id.def_map(&db);
118+
let scope = &def_map[module_id.local_id].scope;
119+
let function_id = scope
120+
.declarations()
121+
.find_map(|x| match x {
122+
hir_def::ModuleDefId::FunctionId(x) => {
123+
let name = db
124+
.function_signature(x)
125+
.name
126+
.display_no_db(file_id.edition(&db))
127+
.to_smolstr();
128+
(name == "main").then_some(x)
129+
}
130+
_ => None,
131+
})
132+
.unwrap();
133+
let hir_body = db.body(function_id.into());
134+
let b = hir_body
135+
.bindings()
136+
.find(|x| x.1.name.display_no_db(file_id.edition(&db)).to_smolstr() == "goal")
137+
.unwrap()
138+
.0;
139+
let infer = db.infer(function_id.into());
140+
let goal_ty = infer.type_of_binding[b];
141+
db.layout_of_ty(goal_ty, db.trait_environment(function_id.into()))
142+
})
138143
}
139144

140145
#[track_caller]

0 commit comments

Comments
 (0)