public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] add `const_assert!` macro and rework documentation
@ 2026-03-19 12:16 Gary Guo
  2026-03-19 12:16 ` [PATCH v3 1/4] rust: move `static_assert` into `build_assert` Gary Guo
                   ` (4 more replies)
  0 siblings, 5 replies; 25+ messages in thread
From: Gary Guo @ 2026-03-19 12:16 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: Yury Norov, rust-for-linux

From: Gary Guo <gary@garyguo.net>

This adds the `const_assert!` macro, rework documentation of all
build-time assertion macros to live under `build_assert` module, and
make that the canonical path to refer to these macros.

The Rust documentation rendering side can be tested out with `make
rustdoc` command.

Changes since v2:
- Rebased on top of latest linux-next to pick up `register!` changes
- Drop the unintended removal of `#[inline(always)]` doc on
  `build_assert!` (Sashiko)
- Remove imports covered by prelude (Danilo)
- Fix references in Nova and new `register!` macro
- Link to v2: https://lore.kernel.org/rust-for-linux/20260316150720.1646109-1-gary@kernel.org/

Changes since v1:
- Completely overhaul of the documentation
- Make `kernel::build_assert` the canonical path to refer to related macros
- Link to v1: https://lore.kernel.org/rust-for-linux/20260206171253.2704684-1-gary@kernel.org/

Cc: Yury Norov <ynorov@nvidia.com>

Gary Guo (4):
  rust: move `static_assert` into `build_assert`
  rust: add `const_assert!` macro
  rust: rework `build_assert!` documentation
  rust: make `build_assert` module the home of related macros

 drivers/gpu/nova-core/bitfield.rs    |   4 +-
 drivers/gpu/nova-core/num.rs         |   2 +-
 rust/kernel/build_assert.rs          | 200 ++++++++++++++++++++++-----
 rust/kernel/dma.rs                   |   5 +-
 rust/kernel/io/register.rs           |  19 ++-
 rust/kernel/io/resource.rs           |   2 +-
 rust/kernel/ioctl.rs                 |   2 +-
 rust/kernel/lib.rs                   |   2 -
 rust/kernel/net/phy/reg.rs           |   8 +-
 rust/kernel/num/bounded.rs           |  26 ++--
 rust/kernel/prelude.rs               |  10 +-
 rust/kernel/ptr.rs                   |  12 +-
 rust/kernel/static_assert.rs         |  39 ------
 rust/kernel/sync/atomic/internal.rs  |   9 +-
 rust/kernel/sync/atomic/predefine.rs |   2 +-
 rust/kernel/sync/locked_by.rs        |   2 +-
 rust/kernel/sync/refcount.rs         |   8 +-
 rust/kernel/xarray.rs                |  10 +-
 scripts/Makefile.build               |   5 +-
 19 files changed, 236 insertions(+), 131 deletions(-)
 delete mode 100644 rust/kernel/static_assert.rs


base-commit: 8e42d2514a7e8eb8d740d0ba82339dd6c0b6463f
-- 
2.51.2


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-03-27 18:42 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 12:16 [PATCH v3 0/4] add `const_assert!` macro and rework documentation Gary Guo
2026-03-19 12:16 ` [PATCH v3 1/4] rust: move `static_assert` into `build_assert` Gary Guo
2026-03-19 14:09   ` Alice Ryhl
2026-03-19 12:16 ` [PATCH v3 2/4] rust: add `const_assert!` macro Gary Guo
2026-03-19 14:12   ` Alice Ryhl
2026-03-19 14:26     ` Gary Guo
2026-03-19 14:34       ` Alice Ryhl
2026-03-21 13:05   ` Alexandre Courbot
2026-03-19 12:16 ` [PATCH v3 3/4] rust: rework `build_assert!` documentation Gary Guo
2026-03-19 14:17   ` Alice Ryhl
2026-03-21 13:05   ` Alexandre Courbot
2026-03-19 12:16 ` [PATCH v3 4/4] rust: make `build_assert` module the home of related macros Gary Guo
2026-03-19 14:14   ` Danilo Krummrich
2026-03-19 14:33   ` Alice Ryhl
2026-03-21 13:05   ` Alexandre Courbot
2026-03-21 13:32     ` Gary Guo
2026-03-21 13:41       ` Miguel Ojeda
2026-03-22 23:36   ` Miguel Ojeda
2026-03-23  1:08     ` Alexandre Courbot
2026-03-23  1:38       ` Miguel Ojeda
2026-03-23  1:50         ` Alexandre Courbot
2026-03-26 12:09     ` FUJITA Tomonori
2026-03-27 18:42     ` Boqun Feng
2026-03-23  0:15   ` Tamir Duberstein
2026-03-19 14:15 ` [PATCH v3 0/4] add `const_assert!` macro and rework documentation Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox