bevy/crates/bevy_ecs/src
JoJoJet d9113cca6f
Make #[system_param(ignore)] and #[world_query(ignore)] unnecessary (#8030)
# Objective

When using `PhantomData` fields with the `#[derive(SystemParam)]` or
`#[derive(WorldQuery)]` macros, the user is required to add the
`#[system_param(ignore)]` attribute so that the macro knows to treat
that field specially. This is undesirable, since it makes the macro more
fragile and less consistent.

## Solution

Implement `SystemParam` and `WorldQuery` for `PhantomData`. This makes
the `ignore` attributes unnecessary.

Some internal changes make the derive macro compatible with types that
have invariant lifetimes, which fixes #8192. From what I can tell, this
fix requires `PhantomData` to implement `SystemParam` in order to ensure
that all of a type's generic parameters are always constrained.

---

## Changelog

+ Implemented `SystemParam` and `WorldQuery` for `PhantomData<T>`.
+ Fixed a miscompilation caused when invariant lifetimes were used with
the `SystemParam` macro.
2023-03-30 15:12:26 +00:00
..
entity Remove redundant bounds check in Entities::get (#8108) 2023-03-16 22:49:36 +00:00
query Make #[system_param(ignore)] and #[world_query(ignore)] unnecessary (#8030) 2023-03-30 15:12:26 +00:00
schedule Fix typo in condition.rs (#8238) 2023-03-28 17:03:39 +00:00
storage Increase type safety and clarity for change detection (#7905) 2023-03-09 17:17:02 +00:00
system Make #[system_param(ignore)] and #[world_query(ignore)] unnecessary (#8030) 2023-03-30 15:12:26 +00:00
world Miscellaneous cleanups to World::resource_scope (#8256) 2023-03-30 10:17:08 +00:00
archetype.rs Document bevy_ecs::storage (#7770) 2023-03-09 07:22:48 +00:00
bundle.rs Reduce branching when inserting components (#8053) 2023-03-21 20:37:25 +00:00
change_detection.rs Increase type safety and clarity for change detection (#7905) 2023-03-09 17:17:02 +00:00
component.rs Increase type safety and clarity for change detection (#7905) 2023-03-09 17:17:02 +00:00
event.rs docs: update docs and comments that still refer to stages (#8156) 2023-03-27 21:50:21 +00:00
lib.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
reflect.rs Bugfix: Scene reload fix (nonbreaking) (#7951) 2023-03-27 22:18:45 +00:00
removal_detection.rs Increase type safety and clarity for change detection (#7905) 2023-03-09 17:17:02 +00:00