Skip to content

Commit d34846b

Browse files
committed
Update salsa version
1 parent ca7d2da commit d34846b

File tree

11 files changed

+11
-39
lines changed

11 files changed

+11
-39
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ rayon = { version = "1.10.0" }
123123
regex = { version = "1.10.2" }
124124
rustc-hash = { version = "2.0.0" }
125125
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
126-
salsa = { git = "https://github.com/ibraheemdev/salsa.git", rev = "22f742a53d9eafca80fe5a0a6b188b56243c741c" }
126+
salsa = { git = "https://github.com/MichaReiser/salsa.git", rev = "c48a9df2ec58d816e0f602ee3fee3ef483b2f1d4" }
127127
schemars = { version = "0.8.16" }
128128
seahash = { version = "4.1.0" }
129129
serde = { version = "1.0.197", features = ["derive"] }

crates/red_knot_python_semantic/src/ast_node_ref.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,6 @@ unsafe impl<T> Send for AstNodeRef<T> where T: Send {}
8686
#[allow(unsafe_code)]
8787
unsafe impl<T> Sync for AstNodeRef<T> where T: Sync {}
8888

89-
#[allow(unsafe_code)]
90-
unsafe impl<T> salsa::Update for AstNodeRef<T> {
91-
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
92-
let old_node: &mut AstNodeRef<T> = unsafe { &mut *old_pointer };
93-
94-
if old_node._parsed == new_value._parsed {
95-
false
96-
} else {
97-
*old_node = new_value;
98-
true
99-
}
100-
}
101-
}
102-
10389
#[cfg(test)]
10490
mod tests {
10591
use crate::ast_node_ref::AstNodeRef;

crates/red_knot_python_semantic/src/semantic_index/ast_ids.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::Db;
2424
///
2525
/// x = foo()
2626
/// ```
27-
#[derive(Debug)]
27+
#[derive(Debug, salsa::Update)]
2828
pub(crate) struct AstIds {
2929
/// Maps expressions to their expression id.
3030
expressions_map: FxHashMap<ExpressionNodeKey, ScopedExpressionId>,
@@ -49,15 +49,6 @@ fn ast_ids<'db>(db: &'db dyn Db, scope: ScopeId) -> &'db AstIds {
4949
semantic_index(db, scope.file(db)).ast_ids(scope.file_scope_id(db))
5050
}
5151

52-
// Always consider AstIds as changed.
53-
#[allow(unsafe_code)]
54-
unsafe impl salsa::Update for AstIds {
55-
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
56-
*old_pointer = new_value;
57-
true
58-
}
59-
}
60-
6152
/// Uniquely identifies a use of a name in a [`crate::semantic_index::symbol::FileScopeId`].
6253
#[newtype_index]
6354
pub struct ScopedUseId;
@@ -83,6 +74,7 @@ impl HasScopedUseId for ast::ExprRef<'_> {
8374

8475
/// Uniquely identifies an [`ast::Expr`] in a [`crate::semantic_index::symbol::FileScopeId`].
8576
#[newtype_index]
77+
#[derive(salsa::Update)]
8678
pub struct ScopedExpressionId;
8779

8880
pub trait HasScopedExpressionId {
@@ -190,7 +182,7 @@ pub(crate) mod node_key {
190182

191183
use crate::node_key::NodeKey;
192184

193-
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
185+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, salsa::Update)]
194186
pub(crate) struct ExpressionNodeKey(NodeKey);
195187

196188
impl From<ast::ExprRef<'_>> for ExpressionNodeKey {

crates/red_knot_python_semantic/src/semantic_index/constraint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub(crate) struct PatternConstraint<'db> {
4040
#[return_ref]
4141
pub(crate) kind: PatternConstraintKind<'db>,
4242

43-
#[no_eq]
4443
count: countme::Count<PatternConstraint<'static>>,
4544
}
4645

crates/red_knot_python_semantic/src/semantic_index/definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ impl ExceptHandlerDefinitionKind {
710710
}
711711
}
712712

713-
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
713+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, salsa::Update)]
714714
pub(crate) struct DefinitionNodeKey(NodeKey);
715715

716716
impl From<&ast::Alias> for DefinitionNodeKey {

crates/red_knot_python_semantic/src/semantic_index/expression.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ pub(crate) struct Expression<'db> {
4444
pub(crate) node_ref: AstNodeRef<ast::Expr>,
4545

4646
/// Should this expression be inferred as a normal expression or a type expression?
47-
#[id]
4847
pub(crate) kind: ExpressionKind,
4948

50-
#[no_eq]
5149
count: countme::Count<Expression<'static>>,
5250
}
5351

crates/red_knot_python_semantic/src/semantic_index/symbol.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl From<FileSymbolId> for ScopedSymbolId {
9696

9797
/// Symbol ID that uniquely identifies a symbol inside a [`Scope`].
9898
#[newtype_index]
99+
#[derive(salsa::Update)]
99100
pub struct ScopedSymbolId;
100101

101102
/// A cross-module identifier of a scope that can be used as a salsa query parameter.
@@ -105,7 +106,6 @@ pub struct ScopeId<'db> {
105106

106107
pub file_scope_id: FileScopeId,
107108

108-
#[no_eq]
109109
count: countme::Count<ScopeId<'static>>,
110110
}
111111

@@ -157,6 +157,7 @@ impl<'db> ScopeId<'db> {
157157

158158
/// ID that uniquely identifies a scope inside of a module.
159159
#[newtype_index]
160+
#[derive(salsa::Update)]
160161
pub struct FileScopeId;
161162

162163
impl FileScopeId {

crates/red_knot_python_semantic/src/types/infer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6432,6 +6432,7 @@ mod tests {
64326432
assert_eq!(attr_ty.display(&db).to_string(), "Unknown | str | None");
64336433
db.take_salsa_events()
64346434
};
6435+
64356436
assert_function_query_was_not_run(
64366437
&db,
64376438
infer_expression_types,

crates/red_knot_python_semantic/src/unpack.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ pub(crate) struct Unpack<'db> {
4343
#[no_eq]
4444
pub(crate) value: UnpackValue<'db>,
4545

46-
#[no_eq]
4746
count: countme::Count<Unpack<'static>>,
4847
}
4948

0 commit comments

Comments
 (0)