Re: [PATCH 1/3] rust: error: implement ZeroableOption for Error

From: Miguel Ojeda

Date: Mon Oct 12 2026 - 10:20:30 EST


On Wed, Oct 7, 2026 at 4:33 PM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> Rust Binder wants to store an Option<Error> in TransactionInfo, which
> derives Zeroable. Implement ZeroableOption for Error so that
> Option<Error> implements Zeroable.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

If this goes through Binder:

Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>

Otherwise, if it is not going through there, I can pick it up.

The `// SAFETY` comment could be a bit more verbose, like the one you
have in `drivers/android/binder/error.rs`, e.g.

// SAFETY: `Error` is `repr(transparent)` over `NonZeroI32`, which
is part of the option layout
// optimization guarantee, so all zeroes is a valid representation
for `None`.

Thanks!

Cheers,
Miguel