Open
Description
Following the full reproduction (with more context) here, the following code produces the two following errors:
use bevy::prelude::*;
#[derive(Debug)]
struct MyResource;
// The user has forgotten to add the Res wrapper around MyResource
fn malformed_system_parameter_system(my_res: MyResource) {}
// The user has invalidly requested a mutable reference to Commands,
// rather using `mut commands: Commands`
fn requesting_commands_as_reference_system(commands: &mut Commands) {}
fn main() {
App::new()
//
.add_system(malformed_system_parameter_system)
//
.add_system(requesting_commands_as_reference_system)
.run()
}
Errors:
the trait bound `fn(MyResource) {malformed_system_parameter_system}: IntoSystem<(), (), _>` is not satisfied
required because of the requirements on the impl of `IntoSystemDescriptor<_>` for `fn(MyResource) {malformed_system_parameter_system}`
the trait bound `for<'r, 's, 't0> fn(&'r mut bevy::prelude::Commands<'s, 't0>) {requesting_commands_as_reference_system}: IntoSystem<(), (), _>` is not satisfied
required because of the requirements on the impl of `IntoSystemDescriptor<_>` for `for<'r, 's, 't0> fn(&'r mut bevy::prelude::Commands<'s, 't0>) {requesting_commands_as_reference_system}`
Errors like this occur constantly whenever users try to include a parameter to a function that is transformed into a system that does not implement SystemParam
.
As you might expect, there is quite a bit of type magic required to get this to work at all, and we use an all_tuples
macro to work around the lack of variadic generics.
The ideal error message would identify which argument(s) is at fault, and complain that it does not implement SystemParam
.