bevyengine / bevyengine/bevy

Add `do_not_recommend` annotation to `all_tuples` to improve error messages

Open
#14,591 6 comments 8 reactions 0 assignees View on GitHub
A-ECS A-Reflection C-Usability D-Macros D-Straightforward S-Ready-For-Implementation X-Blessed
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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 (https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/pull/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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.