From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Benno Lossin" <lossin@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Fiona Behrens" <me@kloenk.dev>,
"Christian Schrefl" <chrisi.schrefl@gmail.com>,
"Alban Kurti" <kurti@invicto.ai>
Cc: <rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rust: pin-init: add code blocks to `[try_][pin_]init!` macros
Date: Thu, 11 Sep 2025 11:22:33 +0900 [thread overview]
Message-ID: <DCPM31MOC3A9.25PT1N4AVJ5WZ@nvidia.com> (raw)
In-Reply-To: <20250905140534.3328297-1-lossin@kernel.org>
On Fri Sep 5, 2025 at 11:05 PM JST, Benno Lossin wrote:
> Allow writing `_: { /* any number of statements */ }` in initializers to
> run arbitrary code during initialization.
>
> try_init!(MyStruct {
> _: {
> if check_something() {
> return Err(MyError);
> }
> },
> foo: Foo::new(val),
> _: {
> println!("successfully initialized `MyStruct`");
> },
> })
>
> Link: https://github.com/Rust-for-Linux/pin-init/pull/84/commits/2880a9b898336e2d54f80715f00ce00f21f74d2f
> Signed-off-by: Benno Lossin <lossin@kernel.org>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Thanks, this is going to be very helpful for nova-core as well.
next prev parent reply other threads:[~2025-09-11 2:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 14:05 [PATCH] rust: pin-init: add code blocks to `[try_][pin_]init!` macros Benno Lossin
2025-09-07 10:57 ` Alice Ryhl
2025-09-07 11:20 ` Danilo Krummrich
2025-09-07 11:33 ` Alice Ryhl
2025-09-07 11:49 ` Danilo Krummrich
2025-09-07 17:17 ` Danilo Krummrich
2025-09-10 10:13 ` Danilo Krummrich
2025-09-10 10:19 ` Alice Ryhl
2025-09-10 22:21 ` Gary Guo
2025-09-11 2:22 ` Alexandre Courbot [this message]
2025-09-11 21:34 ` Benno Lossin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DCPM31MOC3A9.25PT1N4AVJ5WZ@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=chrisi.schrefl@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=kurti@invicto.ai \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=me@kloenk.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.