This repository was archived by the owner on Feb 19, 2026. It is now read-only.
Make sure to revert all partially established but eventually conflicting borrows. - #25
Merged
Conversation
Owner
Author
Well actually, this might be stretching it: I cannot really reliably measure any difference in the |
adamreichold
force-pushed
the
consistent-borrows
branch
from
December 26, 2021 12:42
69e48bd to
c248a11
Compare
Owner
Author
|
Actually, I found a variant that has basically additional complexity whatsoever as |
adamreichold
force-pushed
the
consistent-borrows
branch
from
January 3, 2022 06:14
c248a11 to
739cafd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This does add small amount of overhead to
Query::borrowand it was actually a bit difficult to write a test case which would trigger this. (Just querying(&mut T, &mut T)is not sufficient as the fields of a tuple are put on the stack and dropped if one of them panics, i.e. this can only happen if the borrow is conflicting only on some but not all archetypes.)However, it is a correctness question w.r.t. unwind safety even though one cannot circumvent memory safety by exploiting this, just leave behind dead borrows (which are also possible via e.g.
forget(query.borrow(world))).Finally, since we always use
panic="abort"in our simulations, this does not really affect us at alland hence I am somewhat torn between making it generally correct and avoiding the complexity and overhead. It even seems that most users ofhecsdo not care (or at least vocally complain) about the lack of this property either, c.f. Ralith/hecs#209.