mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
Fix ignored lifetimes in #[derive(SystemParam)]
(#7458)
# Objective Fix #7447. The `SystemParam` derive uses the wrong lifetimes for ignored fields. ## Solution Use type inference instead of explicitly naming the types of ignored fields. This allows the compiler to automatically use the correct lifetime.
This commit is contained in:
parent
ff7d5ff444
commit
44a572e4e6
2 changed files with 4 additions and 3 deletions
|
@ -506,7 +506,7 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
|
|||
>::get_param(&mut state.state, system_meta, world, change_tick);
|
||||
#struct_name {
|
||||
#(#fields: #field_locals,)*
|
||||
#(#ignored_fields: <#ignored_field_types>::default(),)*
|
||||
#(#ignored_fields: std::default::Default::default(),)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1541,11 +1541,12 @@ mod tests {
|
|||
}
|
||||
|
||||
// Compile test for https://github.com/bevyengine/bevy/pull/6919.
|
||||
// Regression test for https://github.com/bevyengine/bevy/issues/7447.
|
||||
#[derive(SystemParam)]
|
||||
struct MyParam<'w, T: Resource, Marker: 'static> {
|
||||
struct IgnoredParam<'w, T: Resource, Marker: 'static> {
|
||||
_foo: Res<'w, T>,
|
||||
#[system_param(ignore)]
|
||||
marker: PhantomData<Marker>,
|
||||
marker: PhantomData<&'w Marker>,
|
||||
}
|
||||
|
||||
// Compile tests for https://github.com/bevyengine/bevy/pull/6957.
|
||||
|
|
Loading…
Reference in a new issue