Re: [PATCH v2 1/2] rust: add BitInt integer wrapping type

From: Alice Ryhl
Date: Mon Nov 03 2025 - 05:51:07 EST


On Mon, Nov 03, 2025 at 10:17:48AM +0000, Alice Ryhl wrote:
> On Sun, Nov 02, 2025 at 11:24:42PM +0900, Alexandre Courbot wrote:
> > Add the `BitInt` type, which is an integer on which the number of bits
> > allowed to be used is restricted, capping its maximal value below that
> > of primitive type is wraps.
> >
> > This is useful to e.g. enforce guarantees when working with bit fields.
> >
> > Alongside this type, provide many `From` and `TryFrom` implementations
> > are to reduce friction when using with regular integer types. Proxy
> > implementations of common integer traits are also provided.
> >
> > Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
>
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Actually, I saw Yury's comments on v1 and I have some additional comments
as well. See my reply there.

Alice