mirror of
https://github.com/bevyengine/bevy
synced 2025-01-21 09:34:29 +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. |
||
---|---|---|
.. | ||
access.rs | ||
fetch.rs | ||
filter.rs | ||
iter.rs | ||
mod.rs | ||
par_iter.rs | ||
state.rs |