Re: [PATCH] rust: bitfield: mark `Debug` impl as `#[inline]`
From: Alice Ryhl
Date: Thu Jun 11 2026 - 19:03:50 EST
On Thu, Jun 11, 2026 at 08:05:54PM +0100, 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>
Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>