bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Make `WorldQuery` meta types unnameable

Open joseph-gio opened this issue 2 years ago • 0 comments

Objective

The WorldQuery derive macro can generate three hidden types: QueryState, QueryFetch, and QueryReadOnlyFetch. These are only #[doc(hidden)] though, and are still publicly accessible and can potentially conflict with user-defined types.

Fixes #6264.

Solution

Move the definitions of these types into an anonymous scope, so that are unnamable outside of the derive macro. The QueryItem and QueryReadOnlyItem structs are still nameable, as they are a part of the public API for world query structs.


Changelog

Internal types generated by the WorldQuery derive macro are now unnameable.

Migration Guide

The State and Fetch types for types created using #[derive(WorldQuery)] are now unnameable. If you need to refer to them, use the syntax <T as WorldQuery>::State, <T as WorldQuery>::Fetch.

joseph-gio avatar Mar 08 '23 00:03 joseph-gio