Re: [PATCH v3 10/13] rust: init: implement `Zeroable` for `UnsafeCell<T>` and `Opaque<T>`

From: Martin Rodriguez Reboredo
Date: Sat Aug 05 2023 - 13:16:46 EST


On 7/29/23 06:10, Benno Lossin wrote:
`UnsafeCell<T>` and `T` have the same layout so if `T` is `Zeroable`
then so should `UnsafeCell<T>` be. This allows using the derive macro
for `Zeroable` on types that contain an `UnsafeCell<T>`.
Since `Opaque<T>` contains a `MaybeUninit<T>`, all bytes zero is a valid
bit pattern for that type.

Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
[...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>