don't mark specified values as volatile

This is what we want, but it's not a complete fix.
It does make these tests work, though!
Good enough to commit.
This commit is contained in:
Niko Matsakis 2022-08-10 00:09:34 -04:00
parent eeb47a065c
commit d72803c027
3 changed files with 43 additions and 44 deletions

View file

@ -50,7 +50,7 @@ where
// - a result that is verified in the current revision, because it was set, which will use the set value
// - a result that is NOT verified and has untracked inputs, which will re-execute (and likely panic)
let inputs = QueryInputs {
untracked: true,
untracked: false,
tracked: runtime.empty_dependencies(),
};

View file

@ -84,27 +84,27 @@ fn execute() {
]"#]]);
}
// /// Create and mutate a distinct input. No re-execution required.
// #[test]
// fn red_herring() {
// let mut db = Database::default();
/// Create and mutate a distinct input. No re-execution required.
#[test]
fn red_herring() {
let mut db = Database::default();
// let input = MyInput::new(&mut db, 22);
// assert_eq!(final_result(&db, input), 22);
// db.assert_logs(expect![[r#"
// [
// "final_result(MyInput(Id { value: 1 }))",
// "intermediate_result(MyInput(Id { value: 1 }))",
// ]"#]]);
let input = MyInput::new(&mut db, 22);
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result(MyInput(Id { value: 1 }))",
"intermediate_result(MyInput(Id { value: 1 }))",
]"#]]);
// // Create a distinct input and mutate it.
// // This will trigger a new revision in the database
// // but shouldn't actually invalidate our existing ones.
// let input2 = MyInput::new(&mut db, 44);
// input2.set_field(&mut db, 66);
// Create a distinct input and mutate it.
// This will trigger a new revision in the database
// but shouldn't actually invalidate our existing ones.
let input2 = MyInput::new(&mut db, 44);
input2.set_field(&mut db, 66);
// // Re-run the query on the original input. Nothing re-executes!
// assert_eq!(final_result(&db, input), 22);
// db.assert_logs(expect![[r#"
// []"#]]);
// }
// Re-run the query on the original input. Nothing re-executes!
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[]"#]]);
}

View file

@ -85,28 +85,27 @@ fn one_entity() {
]"#]]);
}
// /// Create and mutate a distinct input. No re-execution required.
// #[test]
// fn red_herring() {
// let mut db = Database::default();
/// Create and mutate a distinct input. No re-execution required.
#[test]
fn red_herring() {
let mut db = Database::default();
// let input = MyInput::new(&mut db, 22);
// assert_eq!(final_result(&db, input), 22);
// db.assert_logs(expect![[r#"
// [
// "final_result(MyInput(Id { value: 1 }))",
// "intermediate_result(MyInput(Id { value: 1 }))",
// ]"#]]);
let input = MyInput::new(&mut db, 22);
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result(MyInput(Id { value: 1 }))",
"intermediate_result(MyInput(Id { value: 1 }))",
]"#]]);
// // Create a distinct input and mutate it.
// // This will trigger a new revision in the database
// // but shouldn't actually invalidate our existing ones.
// let input2 = MyInput::new(&mut db, 44);
// input2.set_field(&mut db, 66);
// Create a distinct input and mutate it.
// This will trigger a new revision in the database
// but shouldn't actually invalidate our existing ones.
let input2 = MyInput::new(&mut db, 44);
input2.set_field(&mut db, 66);
// // Re-run the query on the original input. Nothing re-executes!
// assert_eq!(final_result(&db, input), 22);
// db.assert_logs(expect![[r#"
// [
// ]"#]]);
// }
// Re-run the query on the original input. Nothing re-executes!
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[]"#]]);
}