[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aL46nRkYj2SlOhl8@tardis-2.local>
Date: Sun, 7 Sep 2025 19:08:29 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Benno Lossin <lossin@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Fiona Behrens <me@...enk.dev>, Alban Kurti <kurti@...icto.ai>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof Wilczy´nski <kwilczynski@...nel.org>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: pin-init: add references to previously initialized
fields
On Mon, Sep 08, 2025 at 01:33:26AM +0200, Danilo Krummrich wrote:
> On Mon Sep 8, 2025 at 12:51 AM CEST, Benno Lossin wrote:
> > I actually came up with a third option that looks best IMO:
> >
> > init!(MyStruct {
> > x: 42,
> > #[with_binding]
> > y: 24,
> > z: *y,
> > })
> >
> > The `#[with_binding]` attribute makes the macro generate a variable `y`.
> > `x` & `z` don't give access to their value. (we of course should come up
> > with a better name).
> >
> > Any thoughts?
>
> It may be a bit verbose is some cases, but it makes things pretty obvious, so
> LGTM.
>
> How about just #[bind] or #[access]?
#[shadow] or #[maybe_rebind] ? Or #[pin_ref], the last one is clear
about the purpose.
Regards,
Boqun
Powered by blists - more mailing lists