From 293bd396969eed4cb27fa21efcf5a43ee21dc56a Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Fri, 27 Oct 2023 16:14:50 +0000 Subject: [PATCH] [derive] Emit #[allow(deprecated)] in derived code Makes progress on #553, although we still need to figure out how to reproduce the bug that caused that issue in the first place, and add a test that exercises the same behavior (ie, fails without this commit). --- Cargo.toml | 8 ++++---- zerocopy-derive/Cargo.toml | 2 +- zerocopy-derive/src/lib.rs | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 63048834ee6..b3e8ddfc8ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ [package] edition = "2021" name = "zerocopy" -version = "0.7.15" +version = "0.7.16" authors = ["Joshua Liebow-Feeser "] description = "Utilities for zero-copy parsing and serialization" license = "BSD-2-Clause OR Apache-2.0 OR MIT" @@ -45,7 +45,7 @@ simd-nightly = ["simd"] __internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd"] [dependencies] -zerocopy-derive = { version = "=0.7.15", path = "zerocopy-derive", optional = true } +zerocopy-derive = { version = "=0.7.16", path = "zerocopy-derive", optional = true } [dependencies.byteorder] version = "1.3" @@ -56,7 +56,7 @@ optional = true # zerocopy-derive remain equal, even if the 'derive' feature isn't used. # See: https://github.com/matklad/macro-dep-test [target.'cfg(any())'.dependencies] -zerocopy-derive = { version = "=0.7.15", path = "zerocopy-derive" } +zerocopy-derive = { version = "=0.7.16", path = "zerocopy-derive" } [dev-dependencies] assert_matches = "1.5" @@ -71,4 +71,4 @@ testutil = { path = "testutil" } # CI test failures. trybuild = { version = "=1.0.85", features = ["diff"] } # In tests, unlike in production, zerocopy-derive is not optional -zerocopy-derive = { version = "=0.7.15", path = "zerocopy-derive" } +zerocopy-derive = { version = "=0.7.16", path = "zerocopy-derive" } diff --git a/zerocopy-derive/Cargo.toml b/zerocopy-derive/Cargo.toml index c32301b603e..eced66d7153 100644 --- a/zerocopy-derive/Cargo.toml +++ b/zerocopy-derive/Cargo.toml @@ -9,7 +9,7 @@ [package] edition = "2021" name = "zerocopy-derive" -version = "0.7.15" +version = "0.7.16" authors = ["Joshua Liebow-Feeser "] description = "Custom derive for traits from the zerocopy crate" license = "BSD-2-Clause OR Apache-2.0 OR MIT" diff --git a/zerocopy-derive/src/lib.rs b/zerocopy-derive/src/lib.rs index 3af8ef2a55d..9bdc997472f 100644 --- a/zerocopy-derive/src/lib.rs +++ b/zerocopy-derive/src/lib.rs @@ -617,6 +617,9 @@ fn impl_block( }); quote! { + // TODO(#553): Add a test that generates a warning when + // `#[allow(deprecated)]` isn't present. + #[allow(deprecated)] unsafe impl < #(#params),* > zerocopy::#trait_ident for #type_ident < #(#param_idents),* > where #(#bounds,)*