[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFK7M3CCUXLM.33VAXRHV6U4W0@garyguo.net>
Date: Fri, 09 Jan 2026 16:46:44 +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>, "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 4:39 PM GMT, Benno Lossin wrote:
> 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.
nvm. I forgot about orphan rules from time to time.
>
>>> +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.
I don't think that's the same? I am proposing remove `#[pin]` and build a set at
the very beginning of `fn pin_data` and just use that set. Which is not what the
reference PR does.
Best,
Gary
Powered by blists - more mailing lists