add the fields of tracked struct to the output of queries

This commit is contained in:
XFFXFF 2022-09-13 11:32:05 +08:00
parent 4c4096e39b
commit 99cfca5799
2 changed files with 4 additions and 0 deletions

View file

@ -100,6 +100,8 @@ where
C::Key: TrackedStructInDb<DynDb<'db, C>>,
{
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),

View file

@ -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) })",