linux/rust/macros
Qingsong Chen 4f210ab497 rust: macros: vtable: fix HAS_* redefinition (gen_const_name)
commit 3fa7187ece upstream.

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: b44becc5ee ("rust: macros: add `#[vtable]` proc macro")
Signed-off-by: Qingsong Chen <changxian.cqs@antgroup.com>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Sergio González Collado <sergio.collado@gmail.com>
Link: https://lore.kernel.org/r/20230808025404.2053471-1-changxian.cqs@antgroup.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 17:32:36 +02:00
..
concat_idents.rs rust: macros: add concat_idents! proc macro 2022-12-04 01:59:04 +01:00
helpers.rs rust: macros: Allow specifying multiple module aliases 2023-04-10 23:55:43 +02:00
lib.rs rust: init: add PinnedDrop trait and macros 2023-04-12 18:41:05 +02:00
module.rs rust: error: Rename to_kernel_errno() -> to_errno() 2023-04-12 18:41:04 +02:00
pin_data.rs rust: init: add initialization macros 2023-04-12 18:41:05 +02:00
pinned_drop.rs rust: init: add PinnedDrop trait and macros 2023-04-12 18:41:05 +02:00
quote.rs rust: init: add initialization macros 2023-04-12 18:41:05 +02:00
vtable.rs rust: macros: vtable: fix HAS_* redefinition (gen_const_name) 2023-08-23 17:32:36 +02:00