mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-13 08:48:19 +00:00
29 lines
547 B
Rust
29 lines
547 B
Rust
//! Test that a constant `tracked` fn (has no inputs)
|
|
//! compiles and executes successfully.
|
|
#![allow(warnings)]
|
|
|
|
#[salsa::jar(db = Db)]
|
|
struct Jar(tracked_fn);
|
|
|
|
trait Db: salsa::DbWithJar<Jar> {}
|
|
|
|
#[salsa::tracked]
|
|
fn tracked_fn(db: &dyn Db) -> u32 {
|
|
44
|
|
}
|
|
|
|
#[test]
|
|
fn execute() {
|
|
#[salsa::db(Jar)]
|
|
#[derive(Default)]
|
|
struct Database {
|
|
storage: salsa::Storage<Self>,
|
|
}
|
|
|
|
impl salsa::Database for Database {}
|
|
|
|
impl Db for Database {}
|
|
|
|
let mut db = Database::default();
|
|
assert_eq!(tracked_fn(&db), 44);
|
|
}
|