[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72k2FH9bE3971QChM-EsVMhYpwaWQE33cXUJkr5TnCzJuA@mail.gmail.com>
Date: Thu, 3 Aug 2023 14:52:18 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Qingsong Chen <changxian.cqs@...group.com>
Cc: Gary Guo <gary@...yguo.net>, Alice Ryhl <aliceryhl@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>, alex.gaynor@...il.com,
benno.lossin@...ton.me, bjorn3_gh@...tonmail.com,
boqun.feng@...il.com, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, sergio.collado@...il.com,
田洪亮 <tate.thl@...group.com>,
wedsonaf@...il.com
Subject: Re: [PATCH 1/1] rust: macros: fix redefine const_name in `vtable`
On Thu, Aug 3, 2023 at 11:20 AM Qingsong Chen
<changxian.cqs@...group.com> wrote:
>
> According to the suggestions of Alice and Gary, we could do the fix
> like this:
Could you please send a v2?
I removed the patch from `rust-fixes`, this is the reworded commit
message I used, in case you want to take a look / reuse it (of course,
updating it for v2 as needed):
rust: macros: vtable: fix `HAS_*` redefinition (`gen_const_name`)
If we define the same function name twice in a trait (using `#[cfg]`),
the `vtable` macro will redefine its `gen_const_name`, e.g. this will
define `HAS_BAR` twice:
```rust
#[vtable]
pub trait Foo {
#[cfg(CONFIG_X)]
fn bar();
#[cfg(not(CONFIG_X))]
fn bar(x: usize);
}
```
Use `HashSet` to avoid this.
Thanks!
Cheers,
Miguel
Powered by blists - more mailing lists