diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index 1990f89107774f..3d8a10b3af68ec 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -465,7 +465,8 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream { // 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, diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 11605b6bfbcd6c..d346972056078b 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -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, ()>, + } }