-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SystemTypeSet::system_type
being out of sync with System::type_id
#12030
Fix SystemTypeSet::system_type
being out of sync with System::type_id
#12030
Conversation
F: SystemParamFunction<Marker>, | ||
{ | ||
type Set = SystemTypeSet<Self>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically a breaking change, but IntoSystem<Marker> for F
already requires Marker: 'static
so I don't think any actual code would depend on a non-static marker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant to add this not to the Marker: 'static,
diff line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But of course you could construct pathological examples where someone depends on the exact type used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think this is an acceptable "breaking" change for a patch release.
@bushrat011899, could I get your review here? (Also do you want to be invited to the Bevy org so I can request your review directly?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable, thanks for catching it!
Should this be considered a breaking change? |
If an example of the break could be written down in the patch notes for 0.13.1, then yeah I think it should be listed as a breaking change. I would wager that actually writing an example where a marker is not |
…_id` (bevyengine#12030) ## Objective Always have `some_system.into_system().type_id() == some_system.into_system_set().system_type().unwrap()`. System sets have a `fn system_type() -> Option<TypeId>` that is implemented by `SystemTypeSet` to returning the TypeId of the system's function type. This was implemented in bevyengine#7715 and is used in `bevy_mod_debugdump` to handle `.after(function)` constraints. Back then, `System::type_id` always also returned the type id of the function item, not of `FunctionSystem<M, F>`. bevyengine#11728 changes the behaviour of `System::type_id` so that it returns the id of the `FunctionSystem`/`ExclusiveFunctionSystem` wrapper, but it did not change `SystemTypeSet::system_type`, so doing the lookup breaks in `bevy_mod_debugdump`. ## Solution Change `IntoSystemSet` for functions to return a `SystemTypeSet<FunctionSystem>` / `SystemTypeSet<ExclusiveFunctionSystem>` instead of `SystemTypeSet<F>`.
I more meant the fact that the method is returning something different now. It's mostly treated as an opaque identifier, so probably not an issue, but might be worth a short migration guide so users are aware. |
…_id` (bevyengine#12030) ## Objective Always have `some_system.into_system().type_id() == some_system.into_system_set().system_type().unwrap()`. System sets have a `fn system_type() -> Option<TypeId>` that is implemented by `SystemTypeSet` to returning the TypeId of the system's function type. This was implemented in bevyengine#7715 and is used in `bevy_mod_debugdump` to handle `.after(function)` constraints. Back then, `System::type_id` always also returned the type id of the function item, not of `FunctionSystem<M, F>`. bevyengine#11728 changes the behaviour of `System::type_id` so that it returns the id of the `FunctionSystem`/`ExclusiveFunctionSystem` wrapper, but it did not change `SystemTypeSet::system_type`, so doing the lookup breaks in `bevy_mod_debugdump`. ## Solution Change `IntoSystemSet` for functions to return a `SystemTypeSet<FunctionSystem>` / `SystemTypeSet<ExclusiveFunctionSystem>` instead of `SystemTypeSet<F>`.
…_id` (bevyengine#12030) ## Objective Always have `some_system.into_system().type_id() == some_system.into_system_set().system_type().unwrap()`. System sets have a `fn system_type() -> Option<TypeId>` that is implemented by `SystemTypeSet` to returning the TypeId of the system's function type. This was implemented in bevyengine#7715 and is used in `bevy_mod_debugdump` to handle `.after(function)` constraints. Back then, `System::type_id` always also returned the type id of the function item, not of `FunctionSystem<M, F>`. bevyengine#11728 changes the behaviour of `System::type_id` so that it returns the id of the `FunctionSystem`/`ExclusiveFunctionSystem` wrapper, but it did not change `SystemTypeSet::system_type`, so doing the lookup breaks in `bevy_mod_debugdump`. ## Solution Change `IntoSystemSet` for functions to return a `SystemTypeSet<FunctionSystem>` / `SystemTypeSet<ExclusiveFunctionSystem>` instead of `SystemTypeSet<F>`.
…_id` (#12030) ## Objective Always have `some_system.into_system().type_id() == some_system.into_system_set().system_type().unwrap()`. System sets have a `fn system_type() -> Option<TypeId>` that is implemented by `SystemTypeSet` to returning the TypeId of the system's function type. This was implemented in #7715 and is used in `bevy_mod_debugdump` to handle `.after(function)` constraints. Back then, `System::type_id` always also returned the type id of the function item, not of `FunctionSystem<M, F>`. #11728 changes the behaviour of `System::type_id` so that it returns the id of the `FunctionSystem`/`ExclusiveFunctionSystem` wrapper, but it did not change `SystemTypeSet::system_type`, so doing the lookup breaks in `bevy_mod_debugdump`. ## Solution Change `IntoSystemSet` for functions to return a `SystemTypeSet<FunctionSystem>` / `SystemTypeSet<ExclusiveFunctionSystem>` instead of `SystemTypeSet<F>`.
Objective
Always have
some_system.into_system().type_id() == some_system.into_system_set().system_type().unwrap()
.System sets have a
fn system_type() -> Option<TypeId>
that is implemented bySystemTypeSet
to returning the TypeId of the system's function type. This was implemented in #7715 and is used inbevy_mod_debugdump
to handle.after(function)
constraints.Back then,
System::type_id
always also returned the type id of the function item, not ofFunctionSystem<M, F>
.#11728 changes the behaviour of
System::type_id
so that it returns the id of theFunctionSystem
/ExclusiveFunctionSystem
wrapper, but it did not changeSystemTypeSet::system_type
, so doing the lookup breaks inbevy_mod_debugdump
.Solution
Change
IntoSystemSet
for functions to return aSystemTypeSet<FunctionSystem>
/SystemTypeSet<ExclusiveFunctionSystem>
instead ofSystemTypeSet<F>
.