diff options
Diffstat (limited to 'rust')
-rw-r--r-- | rust/kernel/init.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index 429b485d8825..0e44b3cc2eed 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -202,11 +202,12 @@ use crate::{ error::{self, Error}, sync::UniqueArc, - types::ScopeGuard, + types::{Opaque, ScopeGuard}, }; use alloc::boxed::Box; use core::{ alloc::AllocError, + cell::UnsafeCell, convert::Infallible, marker::PhantomData, mem::MaybeUninit, @@ -1151,6 +1152,11 @@ 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>, // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee). Option<NonZeroU8>, Option<NonZeroU16>, Option<NonZeroU32>, Option<NonZeroU64>, |