[PATCH 0/2] rust: num: add cv! macro to create values from constant expressions (alt)
From: Gary Guo
Date: Fri Aug 28 2026 - 08:09:52 EST
This is an alternative to
https://lore.kernel.org/rust-for-linux/20260828-cv-v1-0-48a180dfc4c8@xxxxxxxxxx/
and
https://lore.kernel.org/rust-for-linux/20260827-chid-v8-3-bc74c77d0214@xxxxxxxxxx
without const generic expressions limitation.
Please see the detailed description in patch 2.
Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
---
Gary Guo (2):
rust: build_assert: add utility to require const eval
rust: num: add `cv!` macro to create values from constant expressions
rust/build_error.rs | 7 ++
rust/kernel/build_assert.rs | 9 +-
rust/kernel/device_id.rs | 4 +
rust/kernel/num.rs | 209 +++++++++++++++++++++++++++++++++++++++++++-
rust/kernel/num/bounded.rs | 21 +++++
rust/kernel/ptr.rs | 21 ++++-
rust/macros/const_eval.rs | 24 +++++
rust/macros/lib.rs | 21 +++++
8 files changed, 313 insertions(+), 3 deletions(-)
---
base-commit: e6664f2b33db9b6811eb4cec109f06cb2b4f458d
change-id: 20260828-cv-acaf3400d16c
Best regards,
--
Gary Guo <gary@xxxxxxxxxxx>