Re: [PATCH] rust: init: remove impl Zeroable for Infallible

From: Alice Ryhl
Date: Thu Mar 14 2024 - 05:15:52 EST


On Thu, Mar 14, 2024 at 12:09 AM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>
> From: Laine Taffin Altman <alexanderaltman@xxxxxx>
>
> It is not enough for a type to be a ZST to guarantee that zeroed memory
> is a valid value for it; it must also be inhabited. Creating a value of
> an uninhabited type, ZST or no, is immediate UB.
> Thus remove the implementation of `Zeroable` for `Infallible`, since
> that type is not inhabited.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 38cde0bd7b67 ("rust: init: add `Zeroable` trait and `init::zeroed` function")
> Closes: https://github.com/Rust-for-Linux/pinned-init/pull/13
> Signed-off-by: Laine Taffin Altman <alexanderaltman@xxxxxx>
> Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>