diff --git a/src/macros.rs b/src/macros.rs index b314f60ff264ddd58c69fb8500c188fa4a94b317..0ef64d572f3a6d989b331a52ec381cd8a1356032 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 e5a9a511c4c08fbe82205cd84638aab26560e59e..55376de92bc4fa1d1bece474345320a2bcea4250 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -306,6 +306,13 @@ s_no_extra_traits! { pub salg_name: [::c_uchar; 64], } + /// 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], @@ -591,6 +598,7 @@ cfg_if! { } } + #[allow(deprecated)] impl af_alg_iv { fn as_slice(&self) -> &[u8] { unsafe { @@ -602,22 +610,26 @@ cfg_if! { } } + #[allow(deprecated)] impl PartialEq for af_alg_iv { fn eq(&self, other: &af_alg_iv) -> bool { *self.as_slice() == *other.as_slice() } } + #[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") - .field("iv", &self.as_slice()) + .field("ivlen", &self.ivlen) .finish() } } + #[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 d6962778e7f869c53d37361e1ea4248a4711c6fa..adf922a411bdd6f1bc2eed4c58e6f4a009dc5380 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -538,6 +538,13 @@ s_no_extra_traits! { pub salg_name: [::c_uchar; 64], } + /// 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], @@ -781,6 +788,7 @@ cfg_if! { } } + #[allow(deprecated)] impl af_alg_iv { fn as_slice(&self) -> &[u8] { unsafe { @@ -792,22 +800,26 @@ cfg_if! { } } + #[allow(deprecated)] impl PartialEq for af_alg_iv { fn eq(&self, other: &af_alg_iv) -> bool { *self.as_slice() == *other.as_slice() } } + #[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") - .field("iv", &self.as_slice()) + .field("ivlen", &self.ivlen) .finish() } } + #[allow(deprecated)] impl ::hash::Hash for af_alg_iv { fn hash<H: ::hash::Hasher>(&self, state: &mut H) { self.as_slice().hash(state);