Skip to content

Commit 512317f

Browse files
diagnostics for label traits
1 parent adc33b5 commit 512317f

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

crates/bevy_app/src/app.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ use std::{
3232

3333
bevy_ecs::define_label!(
3434
/// A strongly-typed class of labels used to identify an [`App`].
35+
#[diagnostic::on_unimplemented(
36+
note = "consider annotating `{Self}` with `#[derive(AppLabel)]`"
37+
)]
3538
AppLabel,
3639
APP_LABEL_INTERNER
3740
);

crates/bevy_ecs/src/label.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ macro_rules! define_label {
142142
}
143143
}
144144

145+
#[diagnostic::do_not_recommend]
145146
impl $label_trait_name for $crate::intern::Interned<dyn $label_trait_name> {
146147

147148
$($interned_extra_methods_impl)*

crates/bevy_ecs/src/schedule/set.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ use crate::{
2020

2121
define_label!(
2222
/// A strongly-typed class of labels used to identify a [`Schedule`](crate::schedule::Schedule).
23+
#[diagnostic::on_unimplemented(
24+
note = "consider annotating `{Self}` with `#[derive(ScheduleLabel)]`"
25+
)]
2326
ScheduleLabel,
2427
SCHEDULE_LABEL_INTERNER
2528
);
2629

2730
define_label!(
2831
/// Types that identify logical groups of systems.
32+
#[diagnostic::on_unimplemented(
33+
note = "consider annotating `{Self}` with `#[derive(SystemSet)]`"
34+
)]
2935
SystemSet,
3036
SYSTEM_SET_INTERNER,
3137
extra_methods: {

crates/bevy_render/src/render_graph/graph.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ use super::{EdgeExistence, InternedRenderLabel, IntoRenderNodeArray};
1414
pub use bevy_render_macros::RenderSubGraph;
1515

1616
define_label!(
17+
#[diagnostic::on_unimplemented(
18+
note = "consider annotating `{Self}` with `#[derive(RenderSubGraph)]`"
19+
)]
1720
/// A strongly-typed class of labels used to identify a [`SubGraph`] in a render graph.
1821
RenderSubGraph,
1922
RENDER_SUB_GRAPH_INTERNER

crates/bevy_render/src/render_graph/node.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ pub use bevy_render_macros::RenderLabel;
2323
use super::{InternedRenderSubGraph, RenderSubGraph};
2424

2525
define_label!(
26+
#[diagnostic::on_unimplemented(
27+
note = "consider annotating `{Self}` with `#[derive(RenderLabel)]`"
28+
)]
2629
/// A strongly-typed class of labels used to identify a [`Node`] in a render graph.
2730
RenderLabel,
2831
RENDER_LABEL_INTERNER

0 commit comments

Comments
 (0)