Re: [PATCH] rust: bitfield: mark `Debug` impl as `#[inline]`

From: Alexandre Courbot

Date: Fri Jun 12 2026 - 00:41:37 EST


On Fri Jun 12, 2026 at 4:05 AM JST, Gary Guo wrote:
> From: Gary Guo <gary@xxxxxxxxxxx>
>
> A `Debug` impl is for debugging and is normally not used, and therefore
> should ideally not be code-generated unless used. However, Rust has no way
> of knowing if a dependent crate is going to use the trait impl or not, so
> unless it is marked as `#[inline]`, it will be code-generated in the
> defining crate (as it is not generic).
>
> Mark the impl generated by bitfield macro `#[inline]`, so they do not stay
> in the binary unless used.
>
> This reduces nova-core.o .text by 17% (from 151922 bytes to 125676 bytes).
>
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>

Ouch, well-spotted. Thanks for this.

Acked-by: Alexandre Courbot <acourbot@xxxxxxxxxx>