Re: [PATCH v3] rust: macros: vtable: fix `HAS_*` redefinition (`gen_const_name`)

Andreas Hindborg (Samsung)
2023-08-09T19:04:23Z

"Qingsong Chen" <changxian.cqs@antgroup.com> writes:

> 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:
>
> #[vtable]
> pub trait Foo {
> #[cfg(CONFIG_X)]
> fn bar();
>
> #[cfg(not(CONFIG_X))]
> fn bar(x: usize);
> }
>
> Fixes: b44becc5ee80 ("rust: macros: add `#[vtable]` proc macro")
> Signed-off-by: Qingsong Chen <changxian.cqs@antgroup.com>

Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>