[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFK98H2AC9OD.3TKEHOTK5CKE1@kernel.org>
Date: Fri, 09 Jan 2026 19:02:59 +0100
From: "Benno Lossin" <lossin@...nel.org>
To: "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>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/12] rust: pin-init: internal: init: add support for
attributes on initializer fields
On Fri Jan 9, 2026 at 2:55 PM CET, Gary Guo wrote:
> On Thu Jan 8, 2026 at 1:50 PM GMT, Benno Lossin wrote:
>> - if let Some(ident) = field.ident() {
>> + if let Some(ident) = kind.ident() {
>> // `mixed_site` ensures that the guard is not accessible to the user-controlled code.
>> let guard = format_ident!("__{ident}_guard", span = Span::mixed_site());
>> - guards.push(guard.clone());
>> res.extend(quote! {
>> + #(#attrs)*
>> // Create the drop guard:
>> //
>> // We rely on macro hygiene to make it impossible for users to access this local
>> @@ -316,13 +332,18 @@ fn init_fields(
>> )
>> };
>> });
>> + guards.push(guard);
>> + guard_attrs.push(attrs);
>
> I think guard_attrs should just get the cfg ones, not including lint levels.
> Otherwise, `#[expect]` would be broken?
Oh yeah that is probably right. I do not yet have extensive attribute
tests due to lack of time.
Do you also think that only cfg ones should be included in the
`#(#attrs)*` in the `quote!` above?
Cheers,
Benno
Powered by blists - more mailing lists