Re: [PATCH v4 12/15] rust: pin-init: internal: init: add support for attributes on initializer fields

From: Gary Guo

Date: Fri Jan 16 2026 - 06:41:57 EST


On Fri Jan 16, 2026 at 10:54 AM GMT, Benno Lossin wrote:
> Initializer fields ought to support the same attributes that are allowed
> in struct initializers on fields. For example, `cfg` or lint levels such
> as `expect`, `allow` etc. Add parsing support for these attributes using
> syn to initializer fields and adjust the macro expansion accordingly.
>
> Tested-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
> Signed-off-by: Benno Lossin <lossin@xxxxxxxxxx>

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> Changes in v4:
> * remove inclusion of `#[cfg_attr(...)]`
> Changes in v3: none
> Changes in v2:
> * only attach cfg attributes to non-user controlled code for fields
> ---
> rust/pin-init/internal/src/init.rs | 69 ++++++++++++++++++++++++------
> 1 file changed, 55 insertions(+), 14 deletions(-)