]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: macros: ignore example with module parameters
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Wed, 14 Jan 2026 18:16:38 +0000 (18:16 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 14 Jan 2026 18:52:43 +0000 (19:52 +0100)
`ModuleParamAccess` uses `SetOnce`, which depends on the helper functions
so the `macros` crate example under `rusttest` fails to build:

    ---- rust/macros/lib.rs - module (line 62) stdout ----
    error: linking with `cc` failed: exit status: 1
      |
      = note:  "cc" "-m64" ...
      = note: some arguments are omitted. use `--verbose` to show all linker arguments
      = note: rust-lld: error: undefined symbol: rust_helper_atomic_try_cmpxchg_relaxed
              >>> referenced by kernel.ecd446ce39a5fcbb-cgu.3
              >>>               kernel.kernel.ecd446ce39a5fcbb-cgu.3.rcgu.o:(kernel::sync::set_once::SetOnce$LT$T$GT$::populate::h8b02644e30bd70bc) in archive ./rust/test/libkernel.rlib

              rust-lld: error: undefined symbol: rust_helper_atomic_set_release
              >>> referenced by kernel.ecd446ce39a5fcbb-cgu.3
              >>>               kernel.kernel.ecd446ce39a5fcbb-cgu.3.rcgu.o:(kernel::sync::set_once::SetOnce$LT$T$GT$::populate::h8b02644e30bd70bc) in archive ./rust/test/libkernel.rlib
              collect2: error: ld returned 1 exit status

Thus ignore that example to fix the error.

[ Only the first one is needed (the other example does not use
  parameters), so we can keep it enabled. Thus I removed that second
  deletion (and reworded a bit).

  We may want to do something better here later on; on the other hand,
  we should get KUnit tests for `macros` too eventually, so we may end
  up removing or repurposing that target anyway, so it is not a big deal.

    - Miguel ]

Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/rust-for-linux/CANiq72mEYacdZmHKvpbahJzO_X_qqYyiSiSTYaWEQZAfp6sbxg@mail.gmail.com/
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Fixes: 0b24f9740f26 ("rust: module: update the module macro with module parameter support")
Link: https://patch.msgid.link/20251210.082603.290476643413141778.fujita.tomonori@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/macros/lib.rs

index b38002151871a33f6b4efea70be2deb6ddad38e2..33f66e86418ab86d146c45aa85cda354d7e19a3b 100644 (file)
@@ -59,7 +59,7 @@ use proc_macro::TokenStream;
 ///
 /// # Examples
 ///
-/// ```
+/// ```ignore
 /// use kernel::prelude::*;
 ///
 /// module!{