Re: [PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

From: Miguel Ojeda
Date: Sun Aug 03 2025 - 11:15:54 EST


On Sun, Aug 3, 2025 at 3:13 PM Alexandre Courbot <acourbot@xxxxxxxxxx> wrote:
>
> We got some interesting feedback on the ACP already. I have been pointed
> to `checked_ilog2` as an equivalent of `last_set_bit`, and it *does*
> indeed work well as a replacement - with the caveat that the name is
> not very natural to me (or anyone familiar with the C interface). Is
> this something we can live with? If we decide to go with the existing
> standard library method, how can we make sure that folks looking for an
> equivalent of `fls` find `checked_ilog2`?

One option is using the `doc(alias = ...)` attribute, which makes it
appear in the search in the rendered docs, and would show easily in
greps too.

Another option is simply wrapping it in an `inline(always)`, I guess,
but I think we can just use the upstream ones, unless we want slightly
different semantics.

Cheers,
Miguel