Skip to content

Commit 09ef75c

Browse files
committed
Add back equality check that went missing
1 parent a324e46 commit 09ef75c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

crates/salsa/src/derived.rs

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ where
4343
impl<Q> DerivedStorage<Q>
4444
where
4545
Q: QueryFunction,
46+
Q::Value: Eq,
4647
{
4748
fn slot(&self, key: &Q::Key) -> Arc<Slot<Q>> {
4849
if let Some(v) = self.slot_map.read().get(key) {
@@ -64,6 +65,7 @@ where
6465
impl<Q> QueryStorageOps<Q> for DerivedStorage<Q>
6566
where
6667
Q: QueryFunction,
68+
Q::Value: Eq,
6769
{
6870
const CYCLE_STRATEGY: crate::plumbing::CycleRecoveryStrategy = Q::CYCLE_STRATEGY;
6971

@@ -139,6 +141,7 @@ where
139141
impl<Q> DerivedQueryStorageOps<Q> for DerivedStorage<Q>
140142
where
141143
Q: QueryFunction,
144+
Q::Value: Eq,
142145
{
143146
fn invalidate<S>(&self, runtime: &mut Runtime, key: &S)
144147
where

crates/salsa/src/derived/slot.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ enum MaybeChangedSinceProbeState<G> {
9494
impl<Q> Slot<Q>
9595
where
9696
Q: QueryFunction,
97+
Q::Value: Eq,
9798
{
9899
pub(super) fn new(database_key_index: DatabaseKeyIndex) -> Self {
99100
Self {
@@ -270,7 +271,7 @@ where
270271
// used to be, that is a "breaking change" that our
271272
// consumers must be aware of. Becoming *more* durable
272273
// is not. See the test `constant_to_non_constant`.
273-
if revisions.durability >= old_memo.revisions.durability {
274+
if revisions.durability >= old_memo.revisions.durability && old_memo.value == value {
274275
debug!(
275276
"read_upgrade({:?}): value is equal, back-dating to {:?}",
276277
self, old_memo.revisions.changed_at,
@@ -550,6 +551,7 @@ where
550551
struct PanicGuard<'me, Q>
551552
where
552553
Q: QueryFunction,
554+
Q::Value: Eq,
553555
{
554556
slot: &'me Slot<Q>,
555557
runtime: &'me Runtime,
@@ -558,6 +560,7 @@ where
558560
impl<'me, Q> PanicGuard<'me, Q>
559561
where
560562
Q: QueryFunction,
563+
Q::Value: Eq,
561564
{
562565
fn new(slot: &'me Slot<Q>, runtime: &'me Runtime) -> Self {
563566
Self { slot, runtime }
@@ -616,6 +619,7 @@ Please report this bug to https://github.com/salsa-rs/salsa/issues."
616619
impl<'me, Q> Drop for PanicGuard<'me, Q>
617620
where
618621
Q: QueryFunction,
622+
Q::Value: Eq,
619623
{
620624
fn drop(&mut self) {
621625
if std::thread::panicking() {

0 commit comments

Comments
 (0)