From d73e8a3d8623c0e63c9d3856533a18e81411d26f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= <esm@eduardosm.net>
Date: Fri, 16 Oct 2020 11:41:15 +0200
Subject: [PATCH] af_alg_iv: Move the deprecated attribute to the struct
 definition and specify version.

---
 src/macros.rs                      |  2 ++
 src/unix/linux_like/android/mod.rs | 19 ++++++++++---------
 src/unix/linux_like/linux/mod.rs   | 19 ++++++++++---------
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/macros.rs b/src/macros.rs
index b314f60f..0ef64d57 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -114,7 +114,9 @@ macro_rules! s_no_extra_traits {
             $(#[$attr])*
             pub struct $i { $($field)* }
         }
+        #[allow(deprecated)]
         impl ::Copy for $i {}
+        #[allow(deprecated)]
         impl ::Clone for $i {
             fn clone(&self) -> $i { *self }
         }
diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs
index c1a04fb7..38d3ba7d 100644
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -308,6 +308,11 @@ s_no_extra_traits! {
 
     /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
     /// type are unsound and will be removed in the future.
+    #[deprecated(
+        note = "this struct has unsafe trait implementations that will be \
+                removed in the future",
+        since = "0.2.80"
+    )]
     pub struct af_alg_iv {
         pub ivlen: u32,
         pub iv: [::c_uchar; 0],
@@ -593,6 +598,7 @@ cfg_if! {
             }
         }
 
+        #[allow(deprecated)]
         impl af_alg_iv {
             fn as_slice(&self) -> &[u8] {
                 unsafe {
@@ -604,20 +610,17 @@ cfg_if! {
             }
         }
 
-        #[deprecated(
-            note = "this trait implementation is unsound and will be removed"
-        )]
+        #[allow(deprecated)]
         impl PartialEq for af_alg_iv {
             fn eq(&self, other: &af_alg_iv) -> bool {
                 *self.as_slice() == *other.as_slice()
            }
         }
 
-        #[deprecated(
-            note = "this trait implementation is unsound and will be removed"
-        )]
+        #[allow(deprecated)]
         impl Eq for af_alg_iv {}
 
+        #[allow(deprecated)]
         impl ::fmt::Debug for af_alg_iv {
             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
                 f.debug_struct("af_alg_iv")
@@ -626,9 +629,7 @@ cfg_if! {
             }
         }
 
-        #[deprecated(
-            note = "this trait implementation is unsound and will be removed"
-        )]
+        #[allow(deprecated)]
         impl ::hash::Hash for af_alg_iv {
             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
                 self.as_slice().hash(state);
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index de4714ed..adf922a4 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -540,6 +540,11 @@ s_no_extra_traits! {
 
     /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
     /// type are unsound and will be removed in the future.
+    #[deprecated(
+        note = "this struct has unsafe trait implementations that will be \
+                removed in the future",
+        since = "0.2.80"
+    )]
     pub struct af_alg_iv {
         pub ivlen: u32,
         pub iv: [::c_uchar; 0],
@@ -783,6 +788,7 @@ cfg_if! {
             }
         }
 
+        #[allow(deprecated)]
         impl af_alg_iv {
             fn as_slice(&self) -> &[u8] {
                 unsafe {
@@ -794,20 +800,17 @@ cfg_if! {
             }
         }
 
-        #[deprecated(
-            note = "this trait implementation is unsound and will be removed"
-        )]
+        #[allow(deprecated)]
         impl PartialEq for af_alg_iv {
             fn eq(&self, other: &af_alg_iv) -> bool {
                 *self.as_slice() == *other.as_slice()
            }
         }
 
-        #[deprecated(
-            note = "this trait implementation is unsound and will be removed"
-        )]
+        #[allow(deprecated)]
         impl Eq for af_alg_iv {}
 
+        #[allow(deprecated)]
         impl ::fmt::Debug for af_alg_iv {
             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
                 f.debug_struct("af_alg_iv")
@@ -816,9 +819,7 @@ cfg_if! {
             }
         }
 
-        #[deprecated(
-            note = "this trait implementation is unsound and will be removed"
-        )]
+        #[allow(deprecated)]
         impl ::hash::Hash for af_alg_iv {
             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
                 self.as_slice().hash(state);
-- 
GitLab