mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-14 17:18:20 +00:00
update tests for new error messages
also fix name of a fn in one case
This commit is contained in:
parent
97fc6a0920
commit
344166617c
4 changed files with 62 additions and 42 deletions
|
@ -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);
|
||||
| ~~~~~~
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Jar> {}
|
||||
|
||||
|
@ -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() {}
|
||||
fn main() {}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue