bevy/crates
Nicola Papale f47c65e640 Fix FilteredAccessSet get_conflicts inconsistency (#5105)
# Objective

* Enable `Res` and `Query` parameter mutual exclusion
* Required for https://github.com/bevyengine/bevy/pull/5080

The `FilteredAccessSet::get_conflicts` methods didn't work properly with
`Res` and `ResMut` parameters. Because those added their access by using
the `combined_access_mut` method and directly modifying the global
access state of the FilteredAccessSet. This caused an inconsistency,
because get_conflicts assumes that ALL added access have a corresponding
`FilteredAccess` added to the `filtered_accesses` field.

In practice, that means that SystemParam that adds their access through
the `Access` returned by `combined_access_mut` and the ones that add
their access using the `add` method lived in two different universes. As
a result, they could never be mutually exclusive.

## Solution

This commit fixes it by removing the `combined_access_mut` method. This
ensures that the `combined_access` field of FilteredAccessSet is always
updated consistently with the addition of a filter. When checking for
filtered access, it is now possible to account for `Res` and `ResMut`
invalid access. This is currently not needed, but might be in the
future.

We add the `add_unfiltered_{read,write}` methods to replace previous
usages of `combined_access_mut`.

We also add improved Debug implementations on FixedBitSet so that their
meaning is much clearer in debug output.


---

## Changelog

* Fix `Res` and `Query` parameter never being mutually exclusive.

## Migration Guide

Note: this mostly changes ECS internals, but since the API is public, it is technically breaking:
* Removed `FilteredAccessSet::combined_access_mut`
  * Replace _immutable_ usage of those by `combined_access`
  * For _mutable_ usages, use the new `add_unfiltered_{read,write}` methods instead of `combined_access_mut` followed by `add_{read,write}`
2022-11-30 13:46:27 -08:00
..
bevy_animation Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_app Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_asset Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_audio Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_core Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_core_pipeline Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_derive Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_diagnostic Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_dylib Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_dynamic_plugin Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_ecs Fix FilteredAccessSet get_conflicts inconsistency (#5105) 2022-11-30 13:46:27 -08:00
bevy_ecs_compile_fail_tests Fix trybuild tests broken by rust 1.65 (#6457) 2022-11-03 15:09:27 +00:00
bevy_encase_derive Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_gilrs Bump gilrs version to 0.10 (#6558) 2022-11-30 13:46:11 -08:00
bevy_gltf Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_hierarchy bevy_scene: Add missing registration for SmallVec<[Entity; 8]> (#6578) 2022-11-30 13:45:41 -08:00
bevy_input Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_internal Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_log Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_macro_utils Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_math Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_mikktspace Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_pbr Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_ptr Respect alignment for zero-sized types stored in the world (#6618) 2022-11-30 13:44:52 -08:00
bevy_reflect Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_render Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_scene Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_sprite Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_tasks Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_text Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_time Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_transform Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_ui Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_utils Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_window Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_winit Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00