salsa/salsa-2022-tests/tests/compile-fail/span-tracked-getter.rs

31 lines
483 B
Rust
Raw Normal View History

2024-04-04 10:21:33 +00:00
#[salsa::jar(db = Db)]
pub struct Jar(MyTracked, my_fn);
pub trait Db: salsa::DbWithJar<Jar> {}
#[salsa::db(Jar)]
#[derive(Default)]
struct Database {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {}
impl Db for Database {}
#[salsa::tracked]
pub struct MyTracked {
field: u32,
}
#[salsa::tracked]
fn my_fn(db: &dyn crate::Db) {
let x = MyTracked::new(db, 22);
x.field(22);
}
fn main() {
let db = Database::default();
2024-04-04 10:21:33 +00:00
my_fn(&db);
}