salsa/tests/tracked_fn_constant.rs

24 lines
459 B
Rust
Raw Normal View History

//! Test that a constant `tracked` fn (has no inputs)
//! compiles and executes successfully.
#![allow(warnings)]
2022-09-03 15:55:31 +00:00
#[salsa::tracked]
2024-07-17 10:41:56 +00:00
fn tracked_fn(db: &dyn salsa::Database) -> u32 {
44
}
#[test]
fn execute() {
2024-07-17 10:41:56 +00:00
#[salsa::db]
#[derive(Default)]
struct Database {
storage: salsa::Storage<Self>,
}
2024-07-17 10:41:56 +00:00
#[salsa::db]
impl salsa::Database for Database {}
let mut db = Database::default();
assert_eq!(tracked_fn(&db), 44);
}