![]() # Objective Fix unsound lifetimes in `Query::join` and `Query::join_filtered`. The joined query allowed access from either input query, but it only took the `'world` lifetime from `self`, not from `other`. This meant that after the borrow of `other` ended, the joined query would unsoundly alias `other`. ## Solution Change the lifetimes on `join` and `join_filtered` to require mutable borrows of the *same* lifetime for the input queries. This ensures both input queries are borrowed for the full lifetime of the joined query. Change `join_inner` to take `other` by value instead of reference so that the returned query is still usable without needing to borrow from a local variable. ## Testing Added a compile-fail test. |
||
---|---|---|
.. | ||
src | ||
tests | ||
.gitignore | ||
Cargo.toml | ||
README.md |
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).
For information on writing tests see compile_fail_utils/README.md.