From 20cb307301288434a270485471d5ecb8ac722e3f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 13 Apr 2024 06:44:33 -0400 Subject: [PATCH] give trait more info about lifetime relationships In particular, the ingredient and the database have the same lifetime. This will be useful later for safety conditions. --- components/salsa-2022/src/ingredient.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/salsa-2022/src/ingredient.rs b/components/salsa-2022/src/ingredient.rs index dc8f2b90..9dfcaab4 100644 --- a/components/salsa-2022/src/ingredient.rs +++ b/components/salsa-2022/src/ingredient.rs @@ -26,7 +26,12 @@ pub trait Ingredient { fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy; /// Has the value for `input` in this ingredient changed after `revision`? - fn maybe_changed_after(&self, db: &DB, input: DependencyIndex, revision: Revision) -> bool; + fn maybe_changed_after<'db>( + &'db self, + db: &'db DB, + input: DependencyIndex, + revision: Revision, + ) -> bool; /// What were the inputs (if any) that were used to create the value at `key_index`. fn origin(&self, key_index: Id) -> Option; @@ -34,7 +39,12 @@ pub trait Ingredient { /// Invoked when the value `output_key` should be marked as valid in the current revision. /// This occurs because the value for `executor`, which generated it, was marked as valid /// in the current revision. - fn mark_validated_output(&self, db: &DB, executor: DatabaseKeyIndex, output_key: Option); + fn mark_validated_output<'db>( + &'db self, + db: &'db DB, + executor: DatabaseKeyIndex, + output_key: Option, + ); /// Invoked when the value `stale_output` was output by `executor` in a previous /// revision, but was NOT output in the current revision.