-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a missing safety invariant to
System::run_unsafe
(#7778)
# Objective The implementation of `System::run_unsafe` for `FunctionSystem` requires that the world is the same one used to initialize the system. However, the `System` trait has no requirements that the world actually matches, which makes this implementation unsound. This was previously mentioned in #7605 (comment) Fixes part of #7833. ## Solution Add the safety invariant that `System::update_archetype_component_access` must be called prior to `System::run_unsafe`. Since `FunctionSystem::update_archetype_component_access` properly validates the world, this ensures that `run_unsafe` is not called with a mismatched world. Most exclusive systems are not required to be run on the same world that they are initialized with, so this is not a concern for them. Systems formed by combining an exclusive system with a regular system *do* require the world to match, however the validation is done inside of `System::run` when needed.
- Loading branch information
1 parent
c320f54
commit 328347f
Showing
5 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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