From a0bdff5af7e785b5e5eb1fe08c8751e008838d75 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 16 Jul 2024 06:05:20 -0400 Subject: [PATCH] wip --- ..._struct_changes_but_fn_depends_on_field_y.rs | 17 ++++++----------- ...n_input_changes_but_fn_depends_on_field_y.rs | 11 ++++++----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/expect_reuse_field_x_of_a_tracked_struct_changes_but_fn_depends_on_field_y.rs b/tests/expect_reuse_field_x_of_a_tracked_struct_changes_but_fn_depends_on_field_y.rs index de0c4099..7eaa9f06 100644 --- a/tests/expect_reuse_field_x_of_a_tracked_struct_changes_but_fn_depends_on_field_y.rs +++ b/tests/expect_reuse_field_x_of_a_tracked_struct_changes_but_fn_depends_on_field_y.rs @@ -7,17 +7,10 @@ mod common; use common::{HasLogger, Logger}; use expect_test::expect; +use salsa::Setter; -#[salsa::jar(db = Db)] -struct Jar( - MyInput, - MyTracked<'_>, - final_result_depends_on_x, - final_result_depends_on_y, - intermediate_result, -); - -trait Db: salsa::DbWithJar + HasLogger {} +#[salsa::db] +trait Db: salsa::Database + HasLogger {} #[salsa::input] struct MyInput { @@ -47,15 +40,17 @@ fn intermediate_result<'db>(db: &'db dyn Db, input: MyInput) -> MyTracked<'db> { MyTracked::new(db, (input.field(db) + 1) / 2, input.field(db) / 2) } -#[salsa::db(Jar)] +#[salsa::db] #[derive(Default)] struct Database { storage: salsa::Storage, logger: Logger, } +#[salsa::db] impl salsa::Database for Database {} +#[salsa::db] impl Db for Database {} impl HasLogger for Database { diff --git a/tests/expect_reuse_field_x_of_an_input_changes_but_fn_depends_on_field_y.rs b/tests/expect_reuse_field_x_of_an_input_changes_but_fn_depends_on_field_y.rs index a304f2b0..5ddb1422 100644 --- a/tests/expect_reuse_field_x_of_an_input_changes_but_fn_depends_on_field_y.rs +++ b/tests/expect_reuse_field_x_of_an_input_changes_but_fn_depends_on_field_y.rs @@ -7,11 +7,10 @@ mod common; use common::{HasLogger, Logger}; use expect_test::expect; +use salsa::Setter; -#[salsa::jar(db = Db)] -struct Jar(MyInput, result_depends_on_x, result_depends_on_y); - -trait Db: salsa::DbWithJar + HasLogger {} +#[salsa::db] +trait Db: salsa::Database + HasLogger {} #[salsa::input] struct MyInput { @@ -31,15 +30,17 @@ fn result_depends_on_y(db: &dyn Db, input: MyInput) -> u32 { input.y(db) - 1 } -#[salsa::db(Jar)] +#[salsa::db] #[derive(Default)] struct Database { storage: salsa::Storage, logger: Logger, } +#[salsa::db] impl salsa::Database for Database {} +#[salsa::db] impl Db for Database {} impl HasLogger for Database {