Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a note to the on_unimplemented message for
QueryData
recommendi…
…ng `&T` and `&mut T`. (#16449) # Objective A new user is likely to try `Query<Component>` instead of `Query<&Component>`. The error message should guide them to the right solution. ## Solution Add a note to the on_unimplemented message for `QueryData` recommending `&T` and `&mut T`. The full error message now looks like: ``` error[E0277]: `A` is not valid to request as data in a `Query` --> crates\bevy_ecs\src\query\world_query.rs:260:18 | 260 | fn system(query: Query<A>) {} | ^^^^^^^^ invalid `Query` data | = help: the trait `fetch::QueryData` is not implemented for `A` = note: if `A` is a component type, try using `&A` or `&mut A` = help: the following other types implement trait `fetch::QueryData`: &'__w mut T &Archetype &T () (F,) (F0, F1) (F0, F1, F2) (F0, F1, F2, F3) and 41 others note: required by a bound in `system::query::Query` --> crates\bevy_ecs\src\system\query.rs:362:37 | 362 | pub struct Query<'world, 'state, D: QueryData, F: QueryFilter = ()> { | ^^^^^^^^^ required by this bound in `Query` ```
- Loading branch information