From 64779737db21f9e506f4562d9923e7037e15ecfb Mon Sep 17 00:00:00 2001 From: David Barsky Date: Fri, 23 Feb 2024 15:34:23 -0500 Subject: [PATCH] internal: fix deadlock introduced by #16643 --- crates/salsa/src/derived.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/salsa/src/derived.rs b/crates/salsa/src/derived.rs index bf532bdccf6..153df999f53 100644 --- a/crates/salsa/src/derived.rs +++ b/crates/salsa/src/derived.rs @@ -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: &>::DynDb, key: &Q::Key) -> Q::Value {