You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-LinterRelated to the linter and custom lintsC-BugA bug in the programD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixes
Has<T> is a zero-sized type that should not be made a query filter. This is because <Has<T> as QueryData>::Item is a bool. See the following example:
// `Has<Name>`'s size is 0.fnmy_system(query:Query<Has<Name>>){// `has_name` is a boolean.for has_name in query {assert!(has_name);}}
Though Has<T> is a ZST because it just contains a PhantomData<T>, when queried, it returns a boolean. This exposes an underlying flaw in zst_query:
The size of the QueryData should not affect the lint, instead the size of the data fetched by that QueryData is what matters.zst_query should look at QueryData::Item, not QueryData itself.
As an extra bonus, zst_query should consider if the type implements QueryFilter before suggesting it be used as a filter instead!
For now, zst_query should remain in nursery until this is addressed.
The text was updated successfully, but these errors were encountered:
BD103
added
A-Linter
Related to the linter and custom lints
C-Bug
A bug in the program
D-Modest
A "normal" level of difficulty; suitable for simple features or challenging fixes
labels
Feb 22, 2025
A-LinterRelated to the linter and custom lintsC-BugA bug in the programD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixes
Has<T>
is a zero-sized type that should not be made a query filter. This is because<Has<T> as QueryData>::Item
is abool
. See the following example:Though
Has<T>
is a ZST because it just contains aPhantomData<T>
, when queried, it returns a boolean. This exposes an underlying flaw inzst_query
:The size of the
QueryData
should not affect the lint, instead the size of the data fetched by thatQueryData
is what matters.zst_query
should look atQueryData::Item
, notQueryData
itself.As an extra bonus,
zst_query
should consider if the type implementsQueryFilter
before suggesting it be used as a filter instead!For now,
zst_query
should remain innursery
until this is addressed.The text was updated successfully, but these errors were encountered: