Missing macro capture reference in `impl_tick_filter!` macro body
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
0.10.1, issue also present in 0.11-dev
## The bug report
The macro body for `bevy_ecs::query::filter::impl_impl_tick_filter!` makes reference to a nonexistent token capture called `$state_name` in its implementation of `<$name as WorldQuery>::update_component_access`. This reference is made in the formatting literal passed to the `panic!` macro, so no error occurs at compile-time. This causes an issue at runtime, as it appears literal in the panic message, obscuring the actual error message.
The problematic code snippet is below:
```rust
fn update_component_access(&id: &ComponentId, access: &mut FilteredAccess) {
if access.access().has_write(id) {
panic!("$state_name<{}> conflicts with a previous access in this query. Shared access cannot coincide with exclusive access.",
std::any::type_name::());
}
access.add_read(id);
}
```
## What went wrong
An example of a problematic panic message caused by this oversight is below:
```
thread 'main' panicked at '$state_name<...> conflicts with a previous access in this query. Shared access cannot coincide with exclusive access.', {index_home_path}\bevy_ecs-0.10.1\src\query\filter.rs:602:1
```
I believe that the above message should contain the actual name of the query item, but instead it includes the literal string `$state_name`, which can obfuscate the source of the problem in larger queries.
Contributor guide
Research direction
Start in bevy_ecs/src/query/filter.rs at the impl_tick_filter! macro and inspect the update_component_access panic message. Reproduce the conflicting-access case described in the issue, then verify that the panic identifies the actual query item instead of displaying the literal $state_name text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100