Re: [PATCH v4 03/13] rust: add derive macro for `Zeroable`

From: Martin Rodriguez Reboredo
Date: Mon Aug 14 2023 - 21:05:07 EST


On 8/14/23 05:46, Benno Lossin wrote:
Add a derive proc-macro for the `Zeroable` trait. The macro supports
structs where every field implements the `Zeroable` trait. This way
`unsafe` implementations can be avoided.

The macro is split into two parts:
- a proc-macro to parse generics into impl and ty generics,
- a declarative macro that expands to the impl block.

Suggested-by: Asahi Lina <lina@xxxxxxxxxxxxx>
Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
v3 -> v4:
- add support for `+` in `quote!`.

v2 -> v3:
- change derive behavior, instead of adding `Zeroable` bounds for every
field, add them only for generic type parameters,
- still check that every field implements `Zeroable`,
- removed Reviewed-by's due to changes.

v1 -> v2:
- fix Zeroable path,
- add Reviewed-by from Gary and Björn.

[...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>