diff --git a/src/derived/slot.rs b/src/derived/slot.rs index 07d0df53..e7fd782e 100644 --- a/src/derived/slot.rs +++ b/src/derived/slot.rs @@ -188,7 +188,7 @@ where if let Some(value) = memo.validate_memoized_value(db, revision_now) { info!("{:?}: validated old memoized value", self,); - db.salsa_event(|| Event { + db.salsa_event(Event { runtime_id: runtime.id(), kind: EventKind::DidValidateMemoizedValue { database_key: self.database_key_index, @@ -342,8 +342,8 @@ where // Release our lock on `self.state`, so other thread can complete. std::mem::drop(state); - db.salsa_event(|| Event { - runtime_id: db.salsa_runtime().id(), + db.salsa_event(Event { + runtime_id: runtime.id(), kind: EventKind::WillBlockOn { other_runtime_id: other_id, database_key: self.database_key_index, diff --git a/src/lib.rs b/src/lib.rs index 02706105..a020887e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -115,7 +115,7 @@ pub trait Database: plumbing::DatabaseStorageTypes + plumbing::DatabaseOps { /// This function is invoked at key points in the salsa /// runtime. It permits the database to be customized and to /// inject logging or other custom behavior. - fn salsa_event(&self, event_fn: impl Fn() -> Event) { + fn salsa_event(&self, event_fn: Event) { #![allow(unused_variables)] } diff --git a/src/runtime.rs b/src/runtime.rs index 8aa4a23a..b1f19282 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -313,10 +313,10 @@ impl Runtime { database_key_index ); - db.salsa_event(|| Event { - runtime_id: db.salsa_runtime().id(), + db.salsa_event(Event { + runtime_id: self.id(), kind: EventKind::WillExecute { - database_key: database_key_index.clone(), + database_key: database_key_index, }, }); diff --git a/tests/on_demand_inputs.rs b/tests/on_demand_inputs.rs index 6b055de1..1b5c7cf1 100644 --- a/tests/on_demand_inputs.rs +++ b/tests/on_demand_inputs.rs @@ -43,9 +43,9 @@ struct Database { } impl salsa::Database for Database { - fn salsa_event(&self, event_fn: impl Fn() -> salsa::Event) { + fn salsa_event(&self, event: salsa::Event) { if let Some(cb) = &self.on_event { - cb(event_fn()) + cb(event) } } } diff --git a/tests/parallel/setup.rs b/tests/parallel/setup.rs index e3ccf0ca..ac44eb02 100644 --- a/tests/parallel/setup.rs +++ b/tests/parallel/setup.rs @@ -192,8 +192,7 @@ pub(crate) struct ParDatabaseImpl { } impl Database for ParDatabaseImpl { - fn salsa_event(&self, event_fn: impl Fn() -> salsa::Event) { - let event = event_fn(); + fn salsa_event(&self, event: salsa::Event) { match event.kind { salsa::EventKind::WillBlockOn { .. } => { self.signal(self.knobs().signal_on_will_block.get());