diff --git a/salsa-2022-tests/tests/compile-fail/input_struct_id_fields_no_setters.stderr b/salsa-2022-tests/tests/compile-fail/input_struct_id_fields_no_setters.stderr index aa6227de..51cf0dbc 100644 --- a/salsa-2022-tests/tests/compile-fail/input_struct_id_fields_no_setters.stderr +++ b/salsa-2022-tests/tests/compile-fail/input_struct_id_fields_no_setters.stderr @@ -5,4 +5,9 @@ error[E0599]: no method named `set_id_one` found for struct `MyInput` in the cur | ------- method `set_id_one` not found for this struct ... 30 | input.set_id_one(1); - | ^^^^^^^^^^ help: there is a method with a similar name: `id_one` + | ^^^^^^^^^^ + | +help: there is a method `id_one` with a similar name + | +30 | input.id_one(1); + | ~~~~~~ diff --git a/salsa-2022-tests/tests/compile-fail/span-tracked-getter.rs b/salsa-2022-tests/tests/compile-fail/span-tracked-getter.rs index 2dbcb9c3..936ad170 100644 --- a/salsa-2022-tests/tests/compile-fail/span-tracked-getter.rs +++ b/salsa-2022-tests/tests/compile-fail/span-tracked-getter.rs @@ -25,6 +25,6 @@ fn my_fn(db: &dyn crate::Db) { } fn main() { - let mut db = Database::default(); + let db = Database::default(); my_fn(&db); } diff --git a/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.rs b/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.rs index 7a5fc84e..3fcc9289 100644 --- a/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.rs +++ b/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.rs @@ -1,5 +1,13 @@ #[salsa::jar(db = Db)] -struct Jar(MyInput, tracked_fn_with_data, tracked_fn_with_db, tracked_fn_with_constructor, tracked_fn_with_one_input, tracked_fn_with_receiver_not_applied_to_impl_block); +struct Jar( + MyInput, + tracked_fn_with_data, + tracked_fn_with_db, + tracked_fn_with_constructor, + tracked_fn_with_one_input, + tracked_fn_with_receiver_not_applied_to_impl_block, + tracked_fn_with_too_many_arguments_for_specify, +); trait Db: salsa::DbWithJar {} @@ -8,7 +16,6 @@ struct MyInput { field: u32, } - #[salsa::tracked(jar = Jar, data = Data)] fn tracked_fn_with_data(db: &dyn Db, input: MyInput) -> u32 { input.field(db) * 2 @@ -24,24 +31,18 @@ fn tracked_fn_with_constructor(db: &dyn Db, input: MyInput) -> u32 { input.field(db) * 2 } +#[salsa::tracked(jar = Jar)] +fn tracked_fn_with_one_input(db: &dyn Db) -> u32 {} #[salsa::tracked(jar = Jar)] -fn tracked_fn_with_one_input(db: &dyn Db) -> u32 { -} - - -#[salsa::tracked(jar = Jar)] -fn tracked_fn_with_receiver_not_applied_to_impl_block(&self, db: &dyn Db) -> u32 { -} +fn tracked_fn_with_receiver_not_applied_to_impl_block(&self, db: &dyn Db) -> u32 {} #[salsa::tracked(jar = Jar, specify)] -fn tracked_fn_with_receiver_not_applied_to_impl_block(db: &dyn Db, input: MyInput, input: MyInput) -> u32 { +fn tracked_fn_with_too_many_arguments_for_specify( + db: &dyn Db, + input: MyInput, + input: MyInput, +) -> u32 { } - - - - - - -fn main() {} \ No newline at end of file +fn main() {} diff --git a/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.stderr b/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.stderr index 7a21ce06..46f19733 100644 --- a/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.stderr +++ b/salsa-2022-tests/tests/compile-fail/tracked_fn_incompatibles.stderr @@ -1,56 +1,70 @@ error: `data` option not allowed here - --> tests/compile-fail/tracked_fn_incompatibles.rs:12:29 + --> tests/compile-fail/tracked_fn_incompatibles.rs:19:29 | -12 | #[salsa::tracked(jar = Jar, data = Data)] +19 | #[salsa::tracked(jar = Jar, data = Data)] | ^^^^ error: `db` option not allowed here - --> tests/compile-fail/tracked_fn_incompatibles.rs:17:29 + --> tests/compile-fail/tracked_fn_incompatibles.rs:24:29 | -17 | #[salsa::tracked(jar = Jar, db = Db)] +24 | #[salsa::tracked(jar = Jar, db = Db)] | ^^ error: `constructor` option not allowed here - --> tests/compile-fail/tracked_fn_incompatibles.rs:22:29 + --> tests/compile-fail/tracked_fn_incompatibles.rs:29:29 | -22 | #[salsa::tracked(jar = Jar, constructor = TrackedFn3)] +29 | #[salsa::tracked(jar = Jar, constructor = TrackedFn3)] | ^^^^^^^^^^^ error: #[salsa::tracked] must also be applied to the impl block for tracked methods - --> tests/compile-fail/tracked_fn_incompatibles.rs:34:55 + --> tests/compile-fail/tracked_fn_incompatibles.rs:38:55 | -34 | fn tracked_fn_with_receiver_not_applied_to_impl_block(&self, db: &dyn Db) -> u32 { +38 | fn tracked_fn_with_receiver_not_applied_to_impl_block(&self, db: &dyn Db) -> u32 {} | ^ error: tracked function takes too many arguments to have its value set with `specify` - --> tests/compile-fail/tracked_fn_incompatibles.rs:37:29 + --> tests/compile-fail/tracked_fn_incompatibles.rs:40:29 | -37 | #[salsa::tracked(jar = Jar, specify)] +40 | #[salsa::tracked(jar = Jar, specify)] | ^^^^^^^ error[E0412]: cannot find type `tracked_fn_with_data` in this scope - --> tests/compile-fail/tracked_fn_incompatibles.rs:2:21 + --> tests/compile-fail/tracked_fn_incompatibles.rs:4:5 | -2 | struct Jar(MyInput, tracked_fn_with_data, tracked_fn_with_db, tracked_fn_with_constructor, tracked_fn_with_one_input, tracked_fn_with_rec... - | ^^^^^^^^^^^^^^^^^^^^ not found in this scope +4 | tracked_fn_with_data, + | ^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `tracked_fn_with_db` in this scope - --> tests/compile-fail/tracked_fn_incompatibles.rs:2:43 + --> tests/compile-fail/tracked_fn_incompatibles.rs:5:5 | -2 | struct Jar(MyInput, tracked_fn_with_data, tracked_fn_with_db, tracked_fn_with_constructor, tracked_fn_with_one_input, tracked_fn_with_rec... - | ^^^^^^^^^^^^^^^^^^ not found in this scope +5 | tracked_fn_with_db, + | ^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `tracked_fn_with_constructor` in this scope - --> tests/compile-fail/tracked_fn_incompatibles.rs:2:63 + --> tests/compile-fail/tracked_fn_incompatibles.rs:6:5 | -2 | struct Jar(MyInput, tracked_fn_with_data, tracked_fn_with_db, tracked_fn_with_constructor, tracked_fn_with_one_input, tracked_fn_with_rec... - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `tracked_fn_with_one_input` +6 | tracked_fn_with_constructor, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `tracked_fn_with_one_input` ... -28 | #[salsa::tracked(jar = Jar)] +34 | #[salsa::tracked(jar = Jar)] | ---------------------------- similarly named struct `tracked_fn_with_one_input` defined here error[E0412]: cannot find type `tracked_fn_with_receiver_not_applied_to_impl_block` in this scope - --> tests/compile-fail/tracked_fn_incompatibles.rs:2:119 + --> tests/compile-fail/tracked_fn_incompatibles.rs:8:5 | -2 | ...r, tracked_fn_with_one_input, tracked_fn_with_receiver_not_applied_to_impl_block); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope +8 | tracked_fn_with_receiver_not_applied_to_impl_block, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + +error[E0412]: cannot find type `tracked_fn_with_too_many_arguments_for_specify` in this scope + --> tests/compile-fail/tracked_fn_incompatibles.rs:9:5 + | +9 | tracked_fn_with_too_many_arguments_for_specify, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + +error[E0308]: mismatched types + --> tests/compile-fail/tracked_fn_incompatibles.rs:35:46 + | +35 | fn tracked_fn_with_one_input(db: &dyn Db) -> u32 {} + | ------------------------- ^^^ expected `u32`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression