What problem does this solve or what need does it fill?
Bevy's error messages for invalid inputs for systems and queries that take SystemParam, QueryData or QueryFilter are terrible: users get a terrible error message saying that the trait isn't implemented for the whole tuple and suggesting a bunch of irrelevant tuples with generic types.
For upstream reports of what these errors look like, please see:
What solution would you like?
Use the soon-to-be-stabilized diagnostic attribute on our key traits, and manually provide more helpful error messages.
#[diagnostic::on_unimplemented(
message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
label = "My Label",
note = "Note 1",
note = "Note 2"
)]
trait ImportantTrait<A> {}
rust-lang/rust#119888 is the stabilization PR which goes over more details of how this works: this will not be available until Rust 1.78.
What alternative(s) have you considered?
- Add variadic generics to upstream Rust (one day).
- Use a macro to determine these things that needs to be added to every system.
bevy_check by @jakobhellermann does this, and is essential prior art.
Additional context
This was brought to my attention by George Semmler on Mastodon.
What problem does this solve or what need does it fill?
Bevy's error messages for invalid inputs for systems and queries that take
SystemParam,QueryDataorQueryFilterare terrible: users get a terrible error message saying that the trait isn't implemented for the whole tuple and suggesting a bunch of irrelevant tuples with generic types.For upstream reports of what these errors look like, please see:
What solution would you like?
Use the soon-to-be-stabilized
diagnosticattribute on our key traits, and manually provide more helpful error messages.rust-lang/rust#119888 is the stabilization PR which goes over more details of how this works: this will not be available until Rust 1.78.
What alternative(s) have you considered?
bevy_checkby @jakobhellermann does this, and is essential prior art.Additional context
This was brought to my attention by George Semmler on Mastodon.