mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-22 21:05:11 +00:00
mark the outputs as valid as we encounter them in deep_verify_memo
This commit is contained in:
parent
c219944699
commit
98d1be0650
5 changed files with 37 additions and 30 deletions
|
@ -5,7 +5,7 @@ use crate::{
|
|||
debug::DebugWithDb,
|
||||
key::DatabaseKeyIndex,
|
||||
runtime::{
|
||||
local_state::{ActiveQueryGuard, QueryOrigin},
|
||||
local_state::{ActiveQueryGuard, QueryOrigin, EdgeKind},
|
||||
StampedValue,
|
||||
},
|
||||
storage::HasJarsDyn,
|
||||
|
@ -186,9 +186,16 @@ where
|
|||
// valid, then some later input I1 might never have executed at all, so verifying
|
||||
// it is still up to date is meaningless.
|
||||
let last_verified_at = old_memo.verified_at.load();
|
||||
for &input in edges.inputs().iter() {
|
||||
if db.maybe_changed_after(input, last_verified_at) {
|
||||
return false;
|
||||
for &(edge_kind, dependency_index) in edges.input_outputs.iter() {
|
||||
match edge_kind {
|
||||
EdgeKind::Input => {
|
||||
if db.maybe_changed_after(dependency_index, last_verified_at) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
EdgeKind::Output => {
|
||||
db.mark_validated_output(database_key_index, dependency_index);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ pub struct QueryEdges {
|
|||
/// Important:
|
||||
///
|
||||
/// * The inputs must be in **execution order** for the red-green algorithm to work.
|
||||
input_outputs: Arc<[(EdgeKind, DependencyIndex)]>,
|
||||
pub input_outputs: Arc<[(EdgeKind, DependencyIndex)]>,
|
||||
}
|
||||
|
||||
impl QueryEdges {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
error[E0277]: the trait bound `MyInput: TrackedStructInDb<dyn Db>` is not satisfied
|
||||
--> tests/compile-fail/specify-does-not-work-if-the-key-is-a-salsa-input.rs:21:28
|
||||
|
|
||||
20 | #[salsa::tracked(jar = Jar, specify)]
|
||||
| ------------------------------------- required by a bound introduced by this call
|
||||
21 | fn tracked_fn(db: &dyn Db, input: MyInput) -> MyTracked {
|
||||
| ^^^^^ the trait `TrackedStructInDb<dyn Db>` is not implemented for `MyInput`
|
||||
|
|
||||
= help: the trait `TrackedStructInDb<DB>` is implemented for `MyTracked`
|
||||
--> tests/compile-fail/specify-does-not-work-if-the-key-is-a-salsa-input.rs:21:28
|
||||
|
|
||||
20 | #[salsa::tracked(jar = Jar, specify)]
|
||||
| ------------------------------------- required by a bound introduced by this call
|
||||
21 | fn tracked_fn(db: &dyn Db, input: MyInput) -> MyTracked {
|
||||
| ^^^^^ the trait `TrackedStructInDb<dyn Db>` is not implemented for `MyInput`
|
||||
|
|
||||
= help: the trait `TrackedStructInDb<DB>` is implemented for `MyTracked`
|
||||
note: required by a bound in `function::specify::<impl FunctionIngredient<C>>::specify_and_record`
|
||||
--> $WORKSPACE/components/salsa-2022/src/function/specify.rs
|
||||
|
|
||||
| C::Key: TrackedStructInDb<DynDb<'db, C>>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `function::specify::<impl FunctionIngredient<C>>::specify_and_record`
|
||||
--> $WORKSPACE/components/salsa-2022/src/function/specify.rs
|
||||
|
|
||||
| C::Key: TrackedStructInDb<DynDb<'db, C>>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `function::specify::<impl FunctionIngredient<C>>::specify_and_record`
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
error[E0277]: the trait bound `MyInterned: TrackedStructInDb<dyn Db>` is not satisfied
|
||||
--> tests/compile-fail/specify-does-not-work-if-the-key-is-a-salsa-interned.rs:22:28
|
||||
|
|
||||
21 | #[salsa::tracked(jar = Jar, specify)]
|
||||
| ------------------------------------- required by a bound introduced by this call
|
||||
22 | fn tracked_fn(db: &dyn Db, input: MyInterned) -> MyTracked {
|
||||
| ^^^^^ the trait `TrackedStructInDb<dyn Db>` is not implemented for `MyInterned`
|
||||
|
|
||||
= help: the trait `TrackedStructInDb<DB>` is implemented for `MyTracked`
|
||||
--> tests/compile-fail/specify-does-not-work-if-the-key-is-a-salsa-interned.rs:22:28
|
||||
|
|
||||
21 | #[salsa::tracked(jar = Jar, specify)]
|
||||
| ------------------------------------- required by a bound introduced by this call
|
||||
22 | fn tracked_fn(db: &dyn Db, input: MyInterned) -> MyTracked {
|
||||
| ^^^^^ the trait `TrackedStructInDb<dyn Db>` is not implemented for `MyInterned`
|
||||
|
|
||||
= help: the trait `TrackedStructInDb<DB>` is implemented for `MyTracked`
|
||||
note: required by a bound in `function::specify::<impl FunctionIngredient<C>>::specify_and_record`
|
||||
--> $WORKSPACE/components/salsa-2022/src/function/specify.rs
|
||||
|
|
||||
| C::Key: TrackedStructInDb<DynDb<'db, C>>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `function::specify::<impl FunctionIngredient<C>>::specify_and_record`
|
||||
--> $WORKSPACE/components/salsa-2022/src/function/specify.rs
|
||||
|
|
||||
| C::Key: TrackedStructInDb<DynDb<'db, C>>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `function::specify::<impl FunctionIngredient<C>>::specify_and_record`
|
||||
|
|
|
@ -31,7 +31,7 @@ impl salsa::Database for Database {}
|
|||
impl Db for Database {}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "accessing fields of tracked struct")]
|
||||
#[should_panic(expected = "`execute` method for field")]
|
||||
fn execute() {
|
||||
let mut db = Database::default();
|
||||
|
||||
|
|
Loading…
Reference in a new issue