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

From: Alexandre Courbot

Date: Sat Jun 13 2026 - 01:43:44 EST


On Fri Jun 12, 2026 at 1:40 PM JST, Alexandre Courbot wrote:
> 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>

Btw, should this be

Fixes: b7b8b4ccdad4 ("rust: extract `bitfield!` macro from `register!`")

?