summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlvin Sun <alvin.sun@linux.dev>2026-08-11 14:39:46 +0800
committerMiguel Ojeda <ojeda@kernel.org>2026-08-12 09:36:26 +0200
commit7d3e99e93382f1a49eab5afe78586a66907e4ff3 (patch)
treeb1ed8619b752857ccfaf02a4d81ce85f9447add3 /scripts
parent98f256e2726262473bfc9e24f3f5cd3509424da4 (diff)
downloadlinux-7d3e99e93382f1a49eab5afe78586a66907e4ff3.tar.gz
linux-7d3e99e93382f1a49eab5afe78586a66907e4ff3.zip
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rustdoc_test_gen.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
index 2018e47c151e..d087c0d9fcb3 100644
--- a/scripts/rustdoc_test_gen.rs
+++ b/scripts/rustdoc_test_gen.rs
@@ -240,7 +240,6 @@ pub extern "C" fn {kunit_name}(__kunit_test: *mut ::kernel::bindings::kunit) {{
const __LOG_PREFIX: &[u8] = b"rust_doctests_kernel\0";
/// Dummy module type for doctest context.
-#[allow(dead_code)]
struct LocalModule;
use kernel::{{