-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add do_not_recommend annotation to all_tuples to improve error messages #14591
Copy link
Copy link
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-ReflectionRuntime information about typesRuntime information about typesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-MacrosCode that generates Rust codeCode that generates Rust codeD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!X-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makersHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-ReflectionRuntime information about typesRuntime information about typesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-MacrosCode that generates Rust codeCode that generates Rust codeD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!X-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makersHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
What problem does this solve or what need does it fill?
The error messages that Bevy / Rust provides when a malformed system, query or system set are provided are notoriously unhelpful (rust-lang/rust#89681). A huge complex error message is displayed, suggesting complex types in a tuple pyramid.
What solution would you like?
Per https://blog.weiznich.de/blog/diagnostic-namespace-do-not-recommend/, the
#[diagnostic(do_not_recommend)]annotation is now ready to use, added in rust-lang/rust#124708.We should add the
do_not_recommendto theall_tuples!macro: these implementations are universally verbose and confusing.Because this feature is not yet stable, we need to detect if it's available:
https://users.rust-lang.org/t/add-unstable-feature-only-if-compiled-on-nightly/27886/2
What alternative(s) have you considered?
We could wait until this feature is stable to use it. This is less than ideal because a) if there are problems for our use case, we want to be able to fix them now. b) stabilization requires successful use in the wild, and Bevy is a prominent user of this functionality.
Or, we could just use the fabled generics. This will take even longer.