mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-07-07 13:25:17 +00:00

There is an assert that `last_interned_at >= last_changed_revision`, and it can fail without this, see the added test.
28 lines
625 B
Rust
28 lines
625 B
Rust
use salsa::{Durability, Setter};
|
|
|
|
#[salsa::interned(no_lifetime)]
|
|
struct Interned {
|
|
field: u32,
|
|
}
|
|
|
|
#[salsa::input]
|
|
struct Input {
|
|
field: i32,
|
|
}
|
|
|
|
#[test]
|
|
fn the_test() {
|
|
let mut db = salsa::DatabaseImpl::default();
|
|
let input = Input::builder(-123456)
|
|
.field_durability(Durability::HIGH)
|
|
.new(&db);
|
|
// Create an intern in an early revision.
|
|
let interned = Interned::new(&db, 0xDEADBEEF);
|
|
// Trigger a new revision.
|
|
input
|
|
.set_field(&mut db)
|
|
.with_durability(Durability::HIGH)
|
|
.to(123456);
|
|
// Read the interned value
|
|
let _ = interned.field(&db);
|
|
}
|