Re: [PATCH v3 1/3] rust: bitfield: add missing doccomments for associated constants

From: Yury Norov

Date: Wed Dec 02 2026 - 20:16:30 EST


On Tue, Dec 01, 2026 at 04:16:19PM +0900, Alexandre Courbot wrote:
> The associated constants describing the range, mask and shift of each
> field do not carry any doccomment. This triggers the `missing_docs` lint
> on bitfields declared with `pub` visibility.
>
> Add a simple doccomment to get rid of that warning.
>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> Reviewed-by: Danilo Krummrich <dakr@xxxxxxxxxx>

Would be nice to have before and after examples in this sort of
patches. Other than that,

Acked-by: Yury Norov <ynorov@xxxxxxxxxx>

> ---
> rust/kernel/bitfield.rs | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/rust/kernel/bitfield.rs b/rust/kernel/bitfield.rs
> index 8d7d78175336..22b1575c177c 100644
> --- a/rust/kernel/bitfield.rs
> +++ b/rust/kernel/bitfield.rs
> @@ -386,9 +386,12 @@ impl $name {
> @private_field_accessors $vis:vis $name:ident $storage:ty : $hi:tt:$lo:tt $field:ident
> ) => {
> ::kernel::macros::paste!(
> + #[doc = concat!("Bit range of the `", stringify!($field), "` field.")]
> $vis const [<$field:upper _RANGE>]: ::core::ops::RangeInclusive<u8> = $lo..=$hi;
> + #[doc = concat!("Bit mask of the `", stringify!($field), "` field.")]
> $vis const [<$field:upper _MASK>]: $storage =
> ((((1 << $hi) - 1) << 1) + 1) - ((1 << $lo) - 1);
> + #[doc = concat!("Bit shift of the `", stringify!($field), "` field.")]
> $vis const [<$field:upper _SHIFT>]: u32 = $lo;
> );
>
>
> --
> 2.56.1