Skip to content

Add do_not_recommend annotation to all_tuples to improve error messages #14591

Open
@alice-i-cecile

Description

@alice-i-cecile

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_recommend to the all_tuples! macro: these implementations are universally verbose and confusing.

Because this feature is not yet stable, we need to detect if it's available:

You can use #![cfg_attr(feature = "...", feature(test))]

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsA-ReflectionRuntime information about typesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-MacrosCode that generates Rust codeD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis 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 makers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions