rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix redefine const_name in `vtable` macro
@ 2023-06-26  7:42 Qingsong Chen
  2023-06-26  7:42 ` [PATCH 1/1] rust: macros: fix redefine const_name in `vtable` Qingsong Chen
  0 siblings, 1 reply; 11+ messages in thread
From: Qingsong Chen @ 2023-06-26  7:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: 田洪亮, Qingsong Chen, Miguel Ojeda,
	Alex Gaynor, Wedson Almeida Filho, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, rust-for-linux

Hi!

When using the `vtable` macro, I may find a problem.
If we define same function name in a trait (using `#[cfg]`),
the `vtable` macro will redefine `gen_const_name` for it, for
example:
```rust
    #[vtable]
    pub trait Foo {
        #[cfg(CONFIG_X)]
        fn bar();

        #[cfg(not(CONFIG_X))]
        fn bar(x: usize);
    }
```
This will define `HAS_BAR` twice. So I try to fix this by
using `HashSet`.

Qingsong Chen (1):
  rust: macros: fix redefine const_name in `vtable`

 rust/macros/vtable.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-08-03 12:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-26  7:42 [PATCH 0/1] Fix redefine const_name in `vtable` macro Qingsong Chen
2023-06-26  7:42 ` [PATCH 1/1] rust: macros: fix redefine const_name in `vtable` Qingsong Chen
2023-06-26 16:49   ` Martin Rodriguez Reboredo
2023-06-28  9:59   ` Benno Lossin
2023-06-28 16:42   ` Gary Guo
2023-08-02 17:39   ` Miguel Ojeda
2023-08-02 17:43     ` Miguel Ojeda
2023-08-02 19:50   ` Alice Ryhl
2023-08-02 20:02     ` Gary Guo
2023-08-03  9:20       ` Qingsong Chen
2023-08-03 12:52         ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).