From 5209735d0bbd794efa40db60ac382c7987a8b2a6 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 19 Jul 2024 06:00:16 -0400 Subject: [PATCH] ensure the fn value is up-to-date --- components/salsa-macro-rules/src/setup_tracked_fn.rs | 1 + tests/accumulate.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/salsa-macro-rules/src/setup_tracked_fn.rs b/components/salsa-macro-rules/src/setup_tracked_fn.rs index 56760ab0..1a25b378 100644 --- a/components/salsa-macro-rules/src/setup_tracked_fn.rs +++ b/components/salsa-macro-rules/src/setup_tracked_fn.rs @@ -227,6 +227,7 @@ macro_rules! setup_tracked_fn { $zalsa::AsId::as_id(&($($input_id),*)) } }; + $Configuration::fn_ingredient($db).fetch($db, key); let database_key_index = $Configuration::fn_ingredient($db).database_key_index(key); $zalsa::accumulated_by($db.as_salsa_database(), database_key_index) } diff --git a/tests/accumulate.rs b/tests/accumulate.rs index de3ee8fb..2a5ddeb4 100644 --- a/tests/accumulate.rs +++ b/tests/accumulate.rs @@ -89,6 +89,12 @@ fn accumulate_once() { // Just call accumulate on a base input to see what happens. let input = MyInput::new(&db, 2, 3); let logs = push_logs::accumulated::(&db, input); + db.assert_logs(expect![[r#" + [ + "push_logs(a = 2, b = 3)", + "push_a_logs(2)", + "push_b_logs(3)", + ]"#]]); expect![[r#" [ "log_b(0 of 3)", @@ -98,12 +104,6 @@ fn accumulate_once() { "log_a(1 of 2)", ]"#]] .assert_eq(&format!("{:#?}", logs)); - db.assert_logs(expect![[r#" - [ - "push_logs(a = 2, b = 3)", - "push_a_logs(2)", - "push_b_logs(3)", - ]"#]]) } #[test]