bevy/crates/bevy_ecs_compile_fail_tests
Joshua Chapman 274ace790b Implement iter() for mutable Queries (#2305)
A sample implementation of how to have `iter()` work on mutable queries without breaking aliasing rules.

# Objective

- Fixes #753

## Solution

- Added a ReadOnlyFetch to WorldQuery that is the `&T` version of `&mut T` that is used to specify the return type for read only operations like `iter()`.
- ~~As the comment suggests specifying the bound doesn't work due to restrictions on defining recursive implementations (like `Or`). However bounds on the functions are fine~~ Never mind I misread how `Or` was constructed, bounds now exist.
- Note that the only mutable one has a new `Fetch` for readonly as the `State` has to be the same for any of this to work


Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-12-01 23:28:10 +00:00
..
src Assert compiler errors for compile_fail tests (#3067) 2021-11-13 22:43:19 +00:00
tests Implement iter() for mutable Queries (#2305) 2021-12-01 23:28:10 +00:00
Cargo.toml Assert compiler errors for compile_fail tests (#3067) 2021-11-13 22:43:19 +00:00
README.md Assert compiler errors for compile_fail tests (#3067) 2021-11-13 22:43:19 +00:00

Compile fail tests for bevy_ecs

This crate is separate from bevy_ecs and not part of the Bevy workspace in order to not fail crater tests for Bevy. The tests assert on the exact compiler errors and can easily fail for new Rust versions due to updated compiler errors (e.g. changes in spans).

The CI workflow executes these tests on the stable rust toolchain (see tools/ci).