Messages in this thread | | | From | Miguel Ojeda <> | Date | Thu, 3 Aug 2023 14:52:18 +0200 | 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@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
| |