Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Diagnostics for label traits (#17441)
# Objective Diagnostics for labels don't suggest how to best implement them. ``` error[E0277]: the trait bound `Label: ScheduleLabel` is not satisfied --> src/main.rs:15:35 | 15 | let mut sched = Schedule::new(Label); | ------------- ^^^^^ the trait `ScheduleLabel` is not implemented for `Label` | | | required by a bound introduced by this call | = help: the trait `ScheduleLabel` is implemented for `Interned<(dyn ScheduleLabel + 'static)>` note: required by a bound in `bevy_ecs::schedule::Schedule::new` --> /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/schedule/schedule.rs:297:28 | 297 | pub fn new(label: impl ScheduleLabel) -> Self { | ^^^^^^^^^^^^^ required by this bound in `Schedule::new` ``` ## Solution `diagnostics::on_unimplemented` and `diagnostics::do_not_recommend` ## Showcase New error message: ``` error[E0277]: the trait bound `Label: ScheduleLabel` is not satisfied --> src/main.rs:15:35 | 15 | let mut sched = Schedule::new(Label); | ------------- ^^^^^ the trait `ScheduleLabel` is not implemented for `Label` | | | required by a bound introduced by this call | = note: consider annotating `Label` with `#[derive(ScheduleLabel)]` note: required by a bound in `bevy_ecs::schedule::Schedule::new` --> /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/schedule/schedule.rs:297:28 | 297 | pub fn new(label: impl ScheduleLabel) -> Self { | ^^^^^^^^^^^^^ required by this bound in `Schedule::new` ```
- Loading branch information