On Tue Aug 11, 2026 at 9:31 PM JST, Miguel Ojeda wrote:
> On Mon, Aug 10, 2026 at 3:57 PM Eliot Courtney <ecourtney@nvidia.com> wrote:
>>
>> rust: num: use const_assert! in Bounded
>> rust: num: reject Bounded::shr overshifts at build time
>> rust: num: add Bounded::shr_exact
>
> Applied to `rust-next` -- thanks everyone!
>
> Alex: I didn't add an implicit Acked-by to the first one but I assume
> you are OK with it:
Yup no problem, I did ack the previous version that included this bit. I
was just a bit slow to react to this one. :)
>
> Suggested-by: Gary Guo <gary@garyguo.net>
> Link: https://lore.kernel.org/rust-for-linux/DKIY9YGIPUUE.SZD2DUQM9NGK@garyguo.net/
>
> The second one is actually fairly important so I did:
>
> [ This implies we can break the type invariant, which in turn means
> we can trigger UB via `Deref`, e.g.:
>
> rust_kernel: panicked at rust/kernel/num/bounded.rs:528:22:
> unsafe precondition(s) violated: hint::unreachable_unchecked
> must never be reached
>
> - Miguel ]
>
> Cc: stable@vger.kernel.org
> Fixes: c59a2d14cd24 ("rust: num: add `shr` and `shl` methods to `Bounded`")
Thanks!