lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFOIX7B383Y0.30X8ZSG4HOJ4M@garyguo.net>
Date: Wed, 14 Jan 2026 18:29:07 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Benno Lossin" <lossin@...nel.org>, "Gary Guo" <gary@...yguo.net>,
 "Miguel Ojeda" <ojeda@...nel.org>, "Boqun Feng" <boqun.feng@...il.com>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
 "Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>,
 "Fiona Behrens" <me@...enk.dev>, "Tamir Duberstein" <tamird@...il.com>,
 "Alban Kurti" <kurti@...icto.ai>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 05/15] rust: pin-init: rewrite `derive(Zeroable)` and
 `derive(MaybeZeroable)` using `syn`

On Wed Jan 14, 2026 at 6:18 PM GMT, Benno Lossin wrote:
> Rewrite the two derive macros for `Zeroable` using `syn`. One positive
> side effect of this change is that tuple structs are now supported by
> them. Additionally, syntax errors and the error emitted when trying to
> use one of the derive macros on an `enum` are improved. Otherwise no
> functional changes intended.
> 
> For example:
> 
>     #[derive(Zeroable)]
>     enum Num {
>         A(u32),
>         B(i32),
>     }
> 
> Produced this error before this commit:
> 
>     error: no rules expected keyword `enum`
>      --> tests/ui/compile-fail/zeroable/enum.rs:5:1
>       |
>     5 | enum Num {
>       | ^^^^ no rules expected this token in macro call
>       |
>     note: while trying to match keyword `struct`
>      --> src/macros.rs
>       |
>       |             $vis:vis struct $name:ident
>       |                      ^^^^^^
> 
> Now the error is:
> 
>     error: cannot derive `Zeroable` for an enum
>      --> tests/ui/compile-fail/zeroable/enum.rs:5:1
>       |
>     5 | enum Num {
>       | ^^^^
> 
>     error: cannot derive `Zeroable` for an enum
> 
> Tested-by: Andreas Hindborg <a.hindborg@...nel.org>
> Signed-off-by: Benno Lossin <lossin@...nel.org>

Reviewed-by: Gary Guo <gary@...yguo.net>

> ---
> Changes in v3:
> * use DiagCtxt error handling
> Changes in v2:
> * improved error handling
> ---
>  rust/pin-init/internal/src/diagnostics.rs |   2 -
>  rust/pin-init/internal/src/lib.rs         |   9 +-
>  rust/pin-init/internal/src/zeroable.rs    | 155 ++++++++++------------
>  rust/pin-init/src/macros.rs               | 124 -----------------
>  4 files changed, 74 insertions(+), 216 deletions(-)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ