diff --git a/components/salsa-macro-rules/src/setup_input_struct.rs b/components/salsa-macro-rules/src/setup_input_struct.rs index b3571fec..d25306b4 100644 --- a/components/salsa-macro-rules/src/setup_input_struct.rs +++ b/components/salsa-macro-rules/src/setup_input_struct.rs @@ -141,23 +141,6 @@ macro_rules! setup_input_struct { pub fn builder($($required_field_id: $required_field_ty),*) -> ::Builder { - // Implement `new` here instead of inside the builder module - // because $Configuration can't be named in `builder`. - impl builder::$Builder { - /// Creates the new input with the set values. - #[must_use] - pub fn new<$Db>(self, db: &$Db) -> $Struct - where - // FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database` - $Db: ?Sized + salsa::Database - { - let current_revision = $zalsa::current_revision(db); - let ingredient = $Configuration::ingredient(db.as_dyn_database()); - let (fields, stamps) = builder::builder_into_inner(self, current_revision); - ingredient.new_input(fields, stamps) - } - } - builder::new_builder($($zalsa::maybe_default!($field_option, $field_ty, $field_id,)),*) } @@ -239,6 +222,23 @@ macro_rules! setup_input_struct { type Builder = builder::$Builder; } + // Implement `new` here instead of inside the builder module + // because $Configuration can't be named in `builder`. + impl builder::$Builder { + /// Creates the new input with the set values. + #[must_use] + pub fn new<$Db>(self, db: &$Db) -> $Struct + where + // FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database` + $Db: ?Sized + salsa::Database + { + let current_revision = $zalsa::current_revision(db); + let ingredient = $Configuration::ingredient(db.as_dyn_database()); + let (fields, stamps) = builder::builder_into_inner(self, current_revision); + ingredient.new_input(fields, stamps) + } + } + mod builder { use super::*; diff --git a/tests/tracked_fn_on_input_with_high_durability.rs b/tests/tracked_fn_on_input_with_high_durability.rs index 1282b6ff..cb35ec6b 100644 --- a/tests/tracked_fn_on_input_with_high_durability.rs +++ b/tests/tracked_fn_on_input_with_high_durability.rs @@ -39,7 +39,7 @@ fn execute() { assert_eq!(tracked_fn(&db, input_low), 44); assert_eq!(tracked_fn(&db, input_high), 4400); - // There's currently no good way to verify whether an input was validated using shallow or deep comparison. + // FIXME: There's currently no good way to verify whether an input was validated using shallow or deep comparison. // All we can do for now is verify that the values were validated. // Note: It maybe confusing why it validates `input_high` when the write has `Durability::LOW`. // This is because all values must be validated whenever a write occurs. It doesn't mean that it