Skip to content

Commit c8f6317

Browse files
committed
Weaken assertion in validate
It's now possible for `mark_validated_output` to be called on a struct that we already validated via `maybe_changed_after` on one of its fields, so `validate` can no longer assert that the struct is out of date.
1 parent d76db1d commit c8f6317

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/tracked_struct/struct_map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ where
118118

119119
// Never update a struct twice in the same revision.
120120
let current_revision = runtime.current_revision();
121-
assert!(data.created_at < current_revision);
121+
assert!(data.created_at <= current_revision);
122122
data.created_at = current_revision;
123123
}
124124

@@ -253,7 +253,7 @@ where
253253
drop(data);
254254

255255
// Validate in current revision, if necessary.
256-
if last_changed < runtime.current_revision() {
256+
if created_at < runtime.current_revision() {
257257
Self::validate_in_map(map, runtime, id);
258258
}
259259

tests/tracked_struct_not_validated_due_to_durability.rs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ fn infer<'db>(db: &'db dyn Db, definition: Definition<'db>) -> Inference<'db> {
6969
infer(db, definitions(db, dependent_file).definition(db))
7070
} else {
7171
db.file(0).field(db);
72+
index(db, file);
7273
Inference::new(db, definition)
7374
}
7475
}

0 commit comments

Comments
 (0)