mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 22:50:19 +00:00
3fba34c9e6
# Objective The method `QueryState::par_iter` does not currently force the query to be read-only. This means you can unsoundly mutate a world through an immutable reference in safe code. ```rust fn bad_system(world: &World, mut query: Local<QueryState<&mut T>>) { query.par_iter(world).for_each_mut(|mut x| *x = unsoundness); } ``` ## Solution Use read-only versions of the `WorldQuery` types. --- ## Migration Guide The function `QueryState::par_iter` now forces any world accesses to be read-only, similar to how `QueryState::iter` works. Any code that previously mutated the world using this method was *unsound*. If you need to mutate the world, use `par_iter_mut` instead. |
||
---|---|---|
.. | ||
entity | ||
query | ||
schedule | ||
storage | ||
system | ||
world | ||
archetype.rs | ||
bundle.rs | ||
change_detection.rs | ||
component.rs | ||
event.rs | ||
lib.rs | ||
reflect.rs | ||
removal_detection.rs |