Skip to content

Commit

Permalink
internal: fix deadlock introduced by #16643
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbarsky committed Feb 23, 2024
1 parent 1214404 commit 6477973
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/salsa/src/derived.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ where
revision: Revision,
) -> bool {
debug_assert!(revision < db.salsa_runtime().current_revision());
let read = &self.slot_map.read();
let read = self.slot_map.read();
let Some((key, slot)) = read.get_index(index as usize) else {
return false;
};
slot.maybe_changed_after(db, revision, key)
let (key, slot) = (key.clone(), slot.clone());
// note: this drop is load-bearing. removing it would causes deadlocks.
drop(read);
slot.maybe_changed_after(db, revision, &key)
}

fn fetch(&self, db: &<Q as QueryDb<'_>>::DynDb, key: &Q::Key) -> Q::Value {
Expand Down

0 comments on commit 6477973

Please sign in to comment.