[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFK7GA22REIQ.1YSKLW77KQAWH@kernel.org>
Date: Fri, 09 Jan 2026 17:39:09 +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>, "Fiona Behrens" <me@...enk.dev>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Alban Kurti"
<kurti@...icto.ai>
Cc: <linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH 06/12] rust: pin-init: rewrite `#[pin_data]` using `syn`
On Fri Jan 9, 2026 at 1:47 PM CET, Gary Guo wrote:
> On Thu Jan 8, 2026 at 1:50 PM GMT, Benno Lossin wrote:
>> +impl Parse for Args {
>> + fn parse(input: syn::parse::ParseStream) -> Result<Self> {
>> + let lh = input.lookahead1();
>> + if lh.peek(End) {
>> + input.parse().map(Self::Nothing)
>
> How about make this `impl Parse for Option<Args>` and remove the nothing
> variant? It looks a bit weird.
`Option` is not fundamental, so I can't change the impl. Parse doesn't
have a blanket impl on `Option`. Maybe I'm not fully understanding the
change you're proposing.
>> +fn strip_pin_annotations(struct_: &mut syn::ItemStruct) {
>> + for field in &mut struct_.fields {
>> + field.attrs.retain(|a| !a.path().is_ident("pin"));
>> + }
>> +}
>
> Multiple places have similar things for stripping annotations and checking if
> structurally pinned. Would it make sense to do this at the very beginning, and
> build a `HashSet` of structurally pinned fields, and use that as canonical
> source for all generate_ functions?
There is https://github.com/Rust-for-Linux/pin-init/pull/94, and I don't
want to take away their work. I'll contact them and see if we can fold
it into this commit/series.
Cheers,
Benno
Powered by blists - more mailing lists