salsa/tests/compile-fail/singleton_only_for_input.rs

26 lines
563 B
Rust
Raw Normal View History

//! Compile Singleton struct test:
//!
//! Singleton flags are only allowed for input structs. If applied on any other Salsa struct compilation must fail
#[salsa::input(singleton)]
struct MyInput {
field: u32,
}
#[salsa::tracked(singleton)]
2024-07-19 12:05:39 +00:00
struct MyTracked<'db> {
field: u32,
}
#[salsa::tracked(singleton)]
2024-07-19 12:05:39 +00:00
fn create_tracked_structs(db: &dyn salsa::Database, input: MyInput) -> Vec<MyTracked> {
(0..input.field(db))
.map(|i| MyTracked::new(db, i))
.collect()
}
#[salsa::accumulator(singleton)]
struct Integers(u32);
fn main() {}