Re: [PATCH v6] rust: kernel: add support for bits/genmask macros

From: Joel Fernandes
Date: Fri Jun 20 2025 - 16:47:23 EST


Hi Daniel,

On 6/20/2025 9:48 AM, Daniel Almeida wrote:
> Hi Joel,
>
>>>>> I think generic over `RangeBounds` is a good idea, and we should
>>>>> .is_emtpy() or .contains() instead of comparison + boolean operation
>>>>> when possible. Seems we need a function to check whether one range
>> I am also of the opinion that RangeBounds is a good idea. I think it may come
>> down to both classes of devs, those who have used genmask before in C and
>> expect inclusivity, and those who are using it for the first time in Rust -
>> the latter may almost always want to use the non-inclusive syntax, no?
>>
>> thanks,
>>
>> - Joel
>
> Can’t do that in a const fn, and we really want a const fn as the default.
> Hence my suggestion to only support a..=b, which is both correct and explicit.

I haven't looked too deeply into the const issue, but the a..=b syntax is fine
with me.

thanks,

- Joel