mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
Like commit 98f256e272 ("rust: doctest: add LocalModule fallback
for #[vtable] ThisModule"), add another `LocalModule` struct with a
null-pointer `ModuleMetadata` `impl` for the `kernel` crate, so that
`crate::LocalModule` (auto-inserted by `#[vtable]`) resolves correctly
when there is no `module!` macro.
This will be needed by DRM to use `#[vtable]` `impl` blocks in KUnit
tests within the `kernel` crate [1].
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/rust-for-linux/DKNAS52KYWLD.M15VEC6U0F6R@kernel.org/ [1]
[ Created commit out of the diff in the link above. Fixed the
`clippy::undocumented_unsafe_blocks` lint by wrapping with a block
like in the other commit too. Added `#[allow(dead_code)]` until we
actually (and unconditionally, i.e. KUnit tests may be not enabled)
use it. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>