lkml.org 
[lkml]   [2023]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/1] rust: macros: fix redefine const_name in `vtable`
On Thu, Aug 3, 2023 at 11:20 AM Qingsong Chen
<changxian.cqs@antgroup.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

\
 
 \ /
  Last update: 2023-08-03 14:53    [W:0.041 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site