Re: [PATCH v2] rust: bitmap: document panics in `next_bit` and `next_zero_bit`

From: Alexandre Courbot

Date: Sun Aug 30 2026 - 21:09:11 EST


On Fri Aug 28, 2026 at 10:35 PM JST, Georgios Androutsopoulos wrote:
> `next_bit()` and `next_zero_bit()` use `bitmap_assert!()` to check
> that `start` is less than `self.len()`, which panics when
> `CONFIG_RUST_BITMAP_HARDENED` is enabled. However, neither function
> has a `# Panics` section, and both document that `None` is returned
> for exactly the input that triggers the panic.
>
> Update the documentation of `next_bit()` and `next_zero_bit()` to add
> the missing `# Panics` sections, add the missing blank doc comment line
> before `Returns` in `next_zero_bit()`, and simplify the wording.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1252

Should this be `Closes:` instead of `Link:`?

> Signed-off-by: Georgios Androutsopoulos <georgeandrout13@xxxxxxxxx>

As I mentioned earlier I hope we can stop panicking on these [1], but
meanwhile it's indeed a good idea to have a Panic section.

Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>

[1] https://lore.kernel.org/DKUKM1RPFDA7.1MBU5EY40OJ4J@xxxxxxxxxx