public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Gary Guo <gary@kernel.org>
To: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: Yury Norov <ynorov@nvidia.com>, rust-for-linux@vger.kernel.org
Subject: [PATCH v3 0/4] add `const_assert!` macro and rework documentation
Date: Thu, 19 Mar 2026 12:16:44 +0000	[thread overview]
Message-ID: <20260319121653.2975748-1-gary@kernel.org> (raw)

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


             reply	other threads:[~2026-03-19 12:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 12:16 Gary Guo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260319121653.2975748-1-gary@kernel.org \
    --to=gary@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ynorov@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox