linux/rust/macros
Alvin Sun 7d3e99e933 rust: macros: auto-insert OwnerModule in #[vtable]
Auto-add `type OwnerModule: ::kernel::ModuleMetadata;` as a required
associated type on the trait side if not already defined, and
auto-insert `type OwnerModule = crate::LocalModule;` on the impl side
if not explicitly provided, eliminating the need to manually declare
and implement `OwnerModule` in every vtable trait and impl.

Assisted-by: opencode:glm-5.2
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Suggested-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/all/DIMMWHUOLPSH.13JFRHDKDQJGO@garyguo.net
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
Link: https://patch.msgid.link/20260811-fix-fops-owner-v10-4-7e71776f9dbe@linux.dev
[ Fixed `rusttest` by adding a dummy `LocalModule`. Removed interim
  `#[allow(dead_code)]`. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
History 2026-08-12 09:36:26 +02:00
..
concat_idents.rs rust: macros: convert concat_idents! to use syn 2026-01-28 00:55:25 +01:00
export.rs rust: macros: convert #[export] to use syn 2026-01-28 00:55:25 +01:00
fmt.rs Rust changes for v6.20 / v7.0 2026-02-10 11:53:01 -08:00
for_lt.rs rust: types: add ForLt trait for higher-ranked lifetime support 2026-05-27 16:24:59 +02:00
helpers.rs rust: allow globally clippy::incompatible_msrv 2026-04-07 09:54:57 +02:00
kunit.rs rust: macros: simplify code using feature(extract_if) 2026-04-07 10:00:24 +02:00
lib.rs rust: macros: auto-insert OwnerModule in #[vtable] 2026-08-12 09:36:26 +02:00
module.rs rust: module: add THIS_MODULE const to ModuleMetadata trait 2026-08-12 09:36:26 +02:00
paste.rs rust: macros: use quote! from vendored crate 2026-01-28 00:55:24 +01:00
vtable.rs rust: macros: auto-insert OwnerModule in #[vtable] 2026-08-12 09:36:26 +02:00