[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DFR4XWXUHLN6.1L05RWCOBEVV0@kernel.org>
Date: Sat, 17 Jan 2026 21:09:47 +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>, "Tamir Duberstein" <tamird@...il.com>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] rust: macros: support `#[cfg]` properly in
`#[vtable]` macro.
On Tue Jan 13, 2026 at 6:05 PM CET, Gary Guo wrote:
> From: Gary Guo <gary@...yguo.net>
>
> Currently, we generate `HAS_` constants as long as the definition exists in
> the source, regardless if it is cfg-ed out or not.
>
> Currently, uses of `#[cfg]` present in both trait and impl, so it is not a
> problem; however if only the impl side uses `#[cfg]` then `HAS_` constants
> will incorrectly be true while it shouldnt't.
>
> With `syn` support, we can now implement `#[cfg]` handling properly by
> propagating the `#[cfg]` attributes to the constants.
>
> Signed-off-by: Gary Guo <gary@...yguo.net>
Reviewed-by: Benno Lossin <lossin@...nel.org>
Cheers,
Benno
> ---
> rust/macros/helpers.rs | 6 ++++++
> rust/macros/vtable.rs | 13 ++++---------
> 2 files changed, 10 insertions(+), 9 deletions(-)
Powered by blists - more mailing lists