]> exis.tech > repos - linux.git/commit
rust: make `build_assert` module the home of related macros
authorGary Guo <gary@garyguo.net>
Tue, 9 Jun 2026 14:26:33 +0000 (15:26 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 10 Jun 2026 07:07:13 +0000 (09:07 +0200)
commit8d49d90fb9f0fd5a0355b4b705395c9ba833415b
treeab8b7a7b667f0c2c67149a5c793d88737ab03972
parent3fff4271809b57182c4011811e96556bdd4cb2f9
rust: make `build_assert` module the home of related macros

Given the macro scoping rules, all macros are rendered twice, in the
module and in the top-level of kernel crate.

Add `#[doc(hidden)]` to the macro definition and `#[doc(inline)]` to the
re-export inside `build_assert` module so the top-level items are hidden.

[ Sadly, because the definition is hidden, `rustdoc` decides to not list
  them as re-exports in the `prelude` page anymore, even if we refer to
  the not-actually-hidden item.

    - Miguel ]

Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Acked-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260609142637.373347-1-gary@kernel.org
[ Kept a single declaration in the prelude, and reworded since they
  already had `no_inline`. Removed other imports from `predefine` since
  we now use the prelude. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
14 files changed:
drivers/gpu/nova-core/bitfield.rs
drivers/gpu/nova-core/num.rs
rust/kernel/build_assert.rs
rust/kernel/io/register.rs
rust/kernel/io/resource.rs
rust/kernel/ioctl.rs
rust/kernel/net/phy/reg.rs
rust/kernel/num/bounded.rs
rust/kernel/prelude.rs
rust/kernel/sync/atomic/internal.rs
rust/kernel/sync/atomic/predefine.rs
rust/kernel/sync/locked_by.rs
rust/kernel/sync/refcount.rs
rust/kernel/xarray.rs