[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72nV1zwoCCcHuizdfqWF=e8hvd6RO1CBXTEt73eqe4ayaA@mail.gmail.com>
Date: Wed, 19 Nov 2025 01:06:28 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Danilo Krummrich <dakr@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Joel Fernandes <joelagnelf@...dia.com>,
Yury Norov <yury.norov@...il.com>, Jesung Yang <y.j3ms.n@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v4 0/4] rust: add Bounded integer type
On Sat, Nov 8, 2025 at 3:24 AM Alexandre Courbot <acourbot@...dia.com> wrote:
>
> Minor revision adding the feedback received on v3.
>
> Patch 3 adds a MAINTAINERS entry in case the Rust core team would like
> us to maintain this, but please ignore it if you prefer to take it under
> the core umbrella.
>
> This series provides `Bounded`, a wrapper type for primitive integers
> that guarantees that only a given number of bits are used to represent
> values. This is particularly useful when working with bitfields, as the
> guarantee that a given value fits within the number of assigned bits can
> be enforced by the type system, saving cumbersome runtime checks, or
> (worse) stripping data when bits are silently dropped.
>
> For a basic usage, please see the rustdoc of the `Bounded` type on the
> second patch.
>
> The first use of this will be to represent bitfields in Nova register
> types to guarantee that no data is ever stripped when manipulating them.
> This should eventually allow the `bitfield` and `register` macros to
> move out of Nova and into the kernel crate.
>
> The last patch is just here to illustrate the use of this module; it is
> not intended to be merged this cycle as it would likely result in big
> merge conflicts with the drm tree.
>
> This series applies on top of drm-rust-next for the needs of the last
> patch, but the first 2 patches should apply cleanly on rust-next. A
> branch with this series and its dependencies is available here:
>
> https://github.com/Gnurou/linux/tree/b4/bounded_ints
>
> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>
Applied to `rust-next` -- thanks everyone!
[ Added intra-doc link. Fixed a few other nits. - Miguel ]
Cheers,
Miguel
Powered by blists - more mailing lists