Silence deprecation warning in Bundle derive macro (#17369) (#17790)

# Objective

- Fixes #17369

## Solution

- Add `#[allow(deprecated)]` to the generated code.
This commit is contained in:
person93 2025-02-10 19:56:09 -05:00 committed by GitHub
parent 83370e0a25
commit 575f66504b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,6 +131,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream {
// - ComponentId is returned in field-definition-order. [get_components] uses field-definition-order // - ComponentId is returned in field-definition-order. [get_components] uses field-definition-order
// - `Bundle::get_components` is exactly once for each member. Rely's on the Component -> Bundle implementation to properly pass // - `Bundle::get_components` is exactly once for each member. Rely's on the Component -> Bundle implementation to properly pass
// the correct `StorageType` into the callback. // the correct `StorageType` into the callback.
#[allow(deprecated)]
unsafe impl #impl_generics #ecs_path::bundle::Bundle for #struct_name #ty_generics #where_clause { unsafe impl #impl_generics #ecs_path::bundle::Bundle for #struct_name #ty_generics #where_clause {
fn component_ids( fn component_ids(
components: &mut #ecs_path::component::Components, components: &mut #ecs_path::component::Components,
@ -156,6 +157,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream {
// SAFETY: // SAFETY:
// - ComponentId is returned in field-definition-order. [from_components] uses field-definition-order // - ComponentId is returned in field-definition-order. [from_components] uses field-definition-order
#[allow(deprecated)]
unsafe impl #impl_generics #ecs_path::bundle::BundleFromComponents for #struct_name #ty_generics #where_clause { unsafe impl #impl_generics #ecs_path::bundle::BundleFromComponents for #struct_name #ty_generics #where_clause {
#[allow(unused_variables, non_snake_case)] #[allow(unused_variables, non_snake_case)]
unsafe fn from_components<__T, __F>(ctx: &mut __T, func: &mut __F) -> Self unsafe fn from_components<__T, __F>(ctx: &mut __T, func: &mut __F) -> Self
@ -168,6 +170,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream {
} }
} }
#[allow(deprecated)]
impl #impl_generics #ecs_path::bundle::DynamicBundle for #struct_name #ty_generics #where_clause { impl #impl_generics #ecs_path::bundle::DynamicBundle for #struct_name #ty_generics #where_clause {
type Effect = (); type Effect = ();
#[allow(unused_variables)] #[allow(unused_variables)]