aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/rust/pin-init/src
diff options
context:
space:
mode:
authorBenno Lossin <benno.lossin@proton.me>2025-03-08 11:04:38 +0000
committerMiguel Ojeda <ojeda@kernel.org>2025-03-16 21:59:18 +0100
commit9d29c682f00c3d8dd5727f6a350c4f6ecccc3913 (patch)
tree5aba0b40a6f65384b85c042beac47c8247ff0234 /rust/pin-init/src
parentrust: pin-init: move `InPlaceInit` and impls of `InPlaceWrite` into the kernel crate (diff)
downloadwireguard-linux-9d29c682f00c3d8dd5727f6a350c4f6ecccc3913.tar.xz
wireguard-linux-9d29c682f00c3d8dd5727f6a350c4f6ecccc3913.zip
rust: pin-init: move impl `Zeroable` for `Opaque` and `Option<KBox<T>>` into the kernel crate
In order to make pin-init a standalone crate, move kernel-specific code directly into the kernel crate. Since `Opaque<T>` and `KBox<T>` are part of the kernel, move their `Zeroable` implementation into the kernel crate. Signed-off-by: Benno Lossin <benno.lossin@proton.me> Tested-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Fiona Behrens <me@kloenk.dev> Link: https://lore.kernel.org/r/20250308110339.2997091-10-benno.lossin@proton.me Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/pin-init/src')
-rw-r--r--rust/pin-init/src/lib.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index f88465e0bb76..aad6486d33fc 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -211,10 +211,7 @@
//! [`pin_data`]: ::macros::pin_data
//! [`pin_init!`]: crate::pin_init!
-use crate::{
- alloc::KBox,
- types::{Opaque, ScopeGuard},
-};
+use crate::{alloc::KBox, types::ScopeGuard};
use core::{
cell::UnsafeCell,
convert::Infallible,
@@ -1342,8 +1339,6 @@ impl_zeroable! {
// SAFETY: Type is allowed to take any value, including all zeros.
{<T>} MaybeUninit<T>,
- // SAFETY: Type is allowed to take any value, including all zeros.
- {<T>} Opaque<T>,
// SAFETY: `T: Zeroable` and `UnsafeCell` is `repr(transparent)`.
{<T: ?Sized + Zeroable>} UnsafeCell<T>,
@@ -1358,7 +1353,6 @@ impl_zeroable! {
//
// In this case we are allowed to use `T: ?Sized`, since all zeros is the `None` variant.
{<T: ?Sized>} Option<NonNull<T>>,
- {<T: ?Sized>} Option<KBox<T>>,
// SAFETY: `null` pointer is valid.
//