mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-10-23 20:59:51 +00:00
test for compile failure: lru can not be used with specify
This commit is contained in:
parent
6fe5062548
commit
738dc3f878
4 changed files with 33 additions and 0 deletions
|
@ -11,3 +11,4 @@ expect-test = "1.4.0"
|
|||
parking_lot = "0.12.1"
|
||||
test-log = "0.2.11"
|
||||
env_logger = "*"
|
||||
trybuild = "1.0"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#[salsa::jar(db = Db)]
|
||||
struct Jar(MyInput, lru_can_not_be_used_with_specify);
|
||||
|
||||
trait Db: salsa::DbWithJar<Jar> {}
|
||||
|
||||
#[salsa::input(jar = Jar)]
|
||||
struct MyInput {
|
||||
field: u32,
|
||||
}
|
||||
|
||||
#[salsa::tracked(jar = Jar, lru = 3, specify)]
|
||||
fn lru_can_not_be_used_with_specify(db: &dyn Db, input: MyInput) -> u32 {
|
||||
input.field(db)
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,11 @@
|
|||
error: `specify` and `lru` cannot be used together
|
||||
--> tests/compile-fail/lru_can_not_be_used_with_specify.rs:11:38
|
||||
|
|
||||
11 | #[salsa::tracked(jar = Jar, lru = 3, specify)]
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0412]: cannot find type `lru_can_not_be_used_with_specify` in this scope
|
||||
--> tests/compile-fail/lru_can_not_be_used_with_specify.rs:2:21
|
||||
|
|
||||
2 | struct Jar(MyInput, lru_can_not_be_used_with_specify);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
5
salsa-2022-tests/tests/compile_fail.rs
Normal file
5
salsa-2022-tests/tests/compile_fail.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#[test]
|
||||
fn compile_fail() {
|
||||
let t = trybuild::TestCases::new();
|
||||
t.compile_fail("tests/compile-fail/*.rs");
|
||||
}
|
Loading…
Reference in a new issue