Skip to content

Commit 20a347e

Browse files
authored
fix: Use changed_at revision when updating fields (#778)
Setting the field's revision to `current_revision` when updating is not technically wrong, but its pessimizing. If all previous reads only observed a change of up to `changed_at`, then it's fine for us to do the same as nothing we derive from has read from `current_revision`.
1 parent 5ee3bdd commit 20a347e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tracked_struct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ where
553553
// to meet its safety invariant.
554554
unsafe {
555555
if C::update_fields(
556-
current_revision,
556+
current_deps.changed_at,
557557
&mut data.revisions,
558558
self.to_self_ptr(std::ptr::addr_of_mut!(data.fields)),
559559
fields,
@@ -568,7 +568,7 @@ where
568568
}
569569
}
570570
if current_deps.durability < data.durability {
571-
data.revisions = C::new_revisions(current_revision);
571+
data.revisions = C::new_revisions(current_deps.changed_at);
572572
data.created_at = current_revision;
573573
}
574574
data.durability = current_deps.durability;

0 commit comments

Comments
 (0)