From: Boqun Feng <boqun.feng@gmail.com>
To: Benno Lossin <benno.lossin@proton.me>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Martin Rodriguez Reboredo" <yakoyoku@gmail.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: init: change the generated name of guard variables
Date: Wed, 3 Apr 2024 15:38:12 -0700 [thread overview]
Message-ID: <Zg3aVLUHkRFxqAh3@boqun-archlinux> (raw)
In-Reply-To: <ef1400ae-ba9e-4656-98db-a882ac720c1e@proton.me>
On Wed, Apr 03, 2024 at 10:09:49PM +0000, Benno Lossin wrote:
> On 03.04.24 23:20, Boqun Feng wrote:
> > On Wed, Apr 03, 2024 at 07:43:37PM +0000, Benno Lossin wrote:
> >> The initializers created by the `[try_][pin_]init!` macros utilize the
> >> guard pattern to drop already initialized fields, when initialization
> >> fails mid-way. These guards are generated to have the same name as the
> >> field that they handle. To prevent namespacing issues when the field
> >
> > Do you have an example of this kind of issues?
>
> https://lore.kernel.org/rust-for-linux/1e8a2a1f-abbf-44ba-8344-705a9cbb1627@proton.me/
>
Ok, so a new binding cannot shadow the name of a constant, that's a bit
surprising, but seems makes sense.
The solution is not ideal (for example, a constant can have the name
"__something_guard"), but nothing better we could I guess.
FWIW:
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Regards,
Boqun
> --
> Cheers,
> Benno
>
>
next prev parent reply other threads:[~2024-04-03 22:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 19:43 [PATCH] rust: init: change the generated name of guard variables Benno Lossin
2024-04-03 21:20 ` Boqun Feng
2024-04-03 22:09 ` Benno Lossin
2024-04-03 22:38 ` Boqun Feng [this message]
2024-04-04 8:53 ` Benno Lossin
2024-04-17 15:06 ` Gary Guo
2024-04-17 15:20 ` Benno Lossin
2024-04-04 12:37 ` Alice Ryhl
2024-05-05 22:27 ` Miguel Ojeda
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=Zg3aVLUHkRFxqAh3@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
--cc=yakoyoku@gmail.com \
/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.