Skip to content

Commit 2498d2f

Browse files
andriyDevtychedelia
authored andcommitted
Fix TypePath derive counting as a usage for deprecated types. (bevyengine#24011)
# Objective - Deprecating a type deriving `TypePath` would cause **the type itself** to trigger a deprecation lint. You couldn't even set `#[allow(deprecated)]`! ## Solution - Add `#[allow(deprecated)]` to the generated code of `TypePath`. ## Testing - The type I was deprecating stopped giving me lint warnings with this.
1 parent ca4290a commit 2498d2f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • crates/bevy_reflect/derive/src/impls

crates/bevy_reflect/derive/src/impls/typed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub(crate) fn impl_type_path(meta: &ReflectMeta) -> TokenStream {
9090
const _: () = {
9191
mod private_scope {
9292
// Compiles if it can be named when there are no imports.
93+
#[allow(deprecated, reason = "derives on a deprecated type shouldn't be considered a usage")]
9394
type AssertIsPrimitive = #type_path;
9495
}
9596
};
@@ -106,6 +107,7 @@ pub(crate) fn impl_type_path(meta: &ReflectMeta) -> TokenStream {
106107
quote! {
107108
#primitive_assert
108109

110+
#[allow(deprecated, reason = "derives on a deprecated type shouldn't be considered a usage")]
109111
impl #impl_generics #bevy_reflect_path::TypePath for #type_path #ty_generics #where_reflect_clause {
110112
fn type_path() -> &'static str {
111113
#long_type_path

0 commit comments

Comments
 (0)