Skip to content

Commit a3a9df9

Browse files
committed
Update Reflect related on_unimplemented messages
Removed redundant messages and provided hints towards `derive` macros where appropriate.
1 parent 00df764 commit a3a9df9

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

crates/bevy_reflect/src/from_reflect.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ use crate::{FromType, Reflect};
2121
/// [derive macro]: bevy_reflect_derive::FromReflect
2222
/// [`DynamicStruct`]: crate::DynamicStruct
2323
/// [crate-level documentation]: crate
24-
#[diagnostic::on_unimplemented(message = "`{Self}` can not be created from a reflection")]
24+
#[diagnostic::on_unimplemented(
25+
message = "`{Self}` can not be created from a reflection",
26+
note = "consider annotating `{Self}` with `#[derive(FromReflect)]`"
27+
)]
2528
pub trait FromReflect: Reflect + Sized {
2629
/// Constructs a concrete instance of `Self` from a reflected value.
2730
fn from_reflect(reflect: &dyn Reflect) -> Option<Self>;

crates/bevy_reflect/src/path/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ impl<'a> From<AccessError<'a>> for ReflectPathError<'a> {
4444
}
4545

4646
/// Something that can be interpreted as a reflection path in [`GetPath`].
47-
#[diagnostic::on_unimplemented(
48-
message = "`{Self}` is not a reflection path",
49-
label = "invalid path"
50-
)]
5147
pub trait ReflectPath<'a>: Sized {
5248
/// Gets a reference to the specified element on the given [`Reflect`] object.
5349
///

crates/bevy_reflect/src/type_info.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ use std::fmt::Debug;
7070
/// ```
7171
///
7272
/// [utility]: crate::utility
73-
#[diagnostic::on_unimplemented(message = "`{Self}` can not be typed through reflection")]
73+
#[diagnostic::on_unimplemented(
74+
message = "`{Self}` can not be typed through reflection",
75+
note = "consider annotating `{Self}` with `#[derive(Reflect)]`"
76+
)]
7477
pub trait Typed: Reflect + TypePath {
7578
/// Returns the compile-time [info] for the underlying type.
7679
///

crates/bevy_reflect/src/type_path.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ use std::fmt;
8282
#[diagnostic::on_unimplemented(
8383
message = "`{Self}` does not have a type path",
8484
label = "invalid type",
85-
note = "consider annotating `{Self}` with `#[derive(TypePath)]`"
85+
note = "consider annotating `{Self}` with `#[derive(Reflect)]` or `#[derive(TypePath)]`"
8686
)]
8787
pub trait TypePath: 'static {
8888
/// Returns the fully qualified path of the underlying type.
@@ -136,7 +136,8 @@ pub trait TypePath: 'static {
136136
/// [`Reflect`]: crate::Reflect
137137
#[diagnostic::on_unimplemented(
138138
message = "`{Self}` can not be used as a dynamic type path",
139-
label = "invalid type"
139+
label = "invalid type",
140+
note = "consider annotating `{Self}` with `#[derive(Reflect)]` or `#[derive(TypePath)]`"
140141
)]
141142
pub trait DynamicTypePath {
142143
/// See [`TypePath::type_path`].

0 commit comments

Comments
 (0)