[PATCH 0/2] rust: num: add cv! macro to create values from constant expressions (alt)

Gary Guo posted 2 patches 4 weeks, 1 day ago
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(-)
[PATCH 0/2] rust: num: add cv! macro to create values from constant expressions (alt)
Posted by Gary Guo 4 weeks, 1 day ago
This is an alternative to
https://lore.kernel.org/rust-for-linux/20260828-cv-v1-0-48a180dfc4c8@nvidia.com/
and
https://lore.kernel.org/rust-for-linux/20260827-chid-v8-3-bc74c77d0214@nvidia.com
without const generic expressions limitation.

Please see the detailed description in patch 2.

Signed-off-by: Gary Guo <gary@garyguo.net>
---
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@garyguo.net>