From 99cfca5799c180764797027a81d161b73c15c321 Mon Sep 17 00:00:00 2001 From: XFFXFF <1247714429@qq.com> Date: Tue, 13 Sep 2022 11:32:05 +0800 Subject: [PATCH] add the fields of tracked struct to the output of queries --- components/salsa-2022/src/function/specify.rs | 3 +++ salsa-2022-tests/tests/deletion.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/components/salsa-2022/src/function/specify.rs b/components/salsa-2022/src/function/specify.rs index 8c0fe19c..17a703d2 100644 --- a/components/salsa-2022/src/function/specify.rs +++ b/components/salsa-2022/src/function/specify.rs @@ -100,6 +100,8 @@ where C::Key: TrackedStructInDb>, { self.specify(db, key, value, |_| QueryOrigin::Field); + let database_key_index = self.database_key_index(key); + db.runtime().add_output(database_key_index.into()); } /// Specify the value for `key` *and* record that we did so. @@ -138,6 +140,7 @@ where // assigneed by `executor`. match memo.revisions.origin { QueryOrigin::Assigned(by_query) => assert_eq!(by_query, executor), + QueryOrigin::Field => {} _ => panic!( "expected a query assigned by `{:?}`, not `{:?}`", executor.debug(db), diff --git a/salsa-2022-tests/tests/deletion.rs b/salsa-2022-tests/tests/deletion.rs index 2860cb39..52ecd772 100644 --- a/salsa-2022-tests/tests/deletion.rs +++ b/salsa-2022-tests/tests/deletion.rs @@ -104,6 +104,7 @@ fn basic() { db.assert_logs(expect![[r#" [ "intermediate_result(MyInput(Id { value: 1 }))", + "salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: field(2) })", "salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })", "salsa_event(DidDiscard { key: MyTracked(2) })", "salsa_event(DidDiscard { key: field(2) })",