Re: [PATCH] rust: bitfield: mark `Debug` impl as `#[inline]`
From: Miguel Ojeda
Date: Tue Jun 16 2026 - 19:37:49 EST
On Thu, Jun 11, 2026 at 9:06 PM Gary Guo <gary@xxxxxxxxxx> 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>
Applied to `rust-fixes` -- thanks!
I am going to pick a couple actual fixes in the coming days, so I
decided to pick this one too for the ride since it is trivial. I may
still rebase though.
Cheers,
Miguel