salsa/tests/tracked_fn_constant.rs
Niko Matsakis 7443277381 wip
2024-07-17 06:41:56 -04:00

23 lines
459 B
Rust

//! Test that a constant `tracked` fn (has no inputs)
//! compiles and executes successfully.
#![allow(warnings)]
#[salsa::tracked]
fn tracked_fn(db: &dyn salsa::Database) -> u32 {
44
}
#[test]
fn execute() {
#[salsa::db]
#[derive(Default)]
struct Database {
storage: salsa::Storage<Self>,
}
#[salsa::db]
impl salsa::Database for Database {}
let mut db = Database::default();
assert_eq!(tracked_fn(&db), 44);
}