Fix a miscompilation with #[derive(SystemParam)] (#7105)

# Objective

- Fix #7103.
- The issue is caused because I forgot to add a where clause to a generated struct in #7056.

## Solution

- Add the where clause.
This commit is contained in:
JoJoJet 2023-01-10 18:41:50 +00:00
parent a207178344
commit fa40e2badb
2 changed files with 11 additions and 1 deletions

View file

@ -465,7 +465,8 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
// <EventReader<'static, 'static, T> as SystemParam>::State
const _: () = {
#[doc(hidden)]
#state_struct_visibility struct FetchState <'w, 's, #(#lifetimeless_generics,)*> {
#state_struct_visibility struct FetchState <'w, 's, #(#lifetimeless_generics,)*>
#where_clause {
state: (#(<#tuple_types as #path::system::SystemParam>::State,)*),
marker: std::marker::PhantomData<(
<#path::prelude::Query<'w, 's, ()> as #path::system::SystemParam>::State,

View file

@ -1639,4 +1639,13 @@ mod tests {
#[derive(SystemParam)]
pub struct EncapsulatedParam<'w>(Res<'w, PrivateResource>);
// regression test for https://github.com/bevyengine/bevy/issues/7103.
#[derive(SystemParam)]
pub struct WhereParam<'w, 's, Q>
where
Q: 'static + WorldQuery,
{
_q: Query<'w, 's, Q, ()>,
}
}