Re: [PATCH] rust: bitfield: always inline test conversions

"Gary Guo" <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Fri Aug 7, 2026 at 6:50 PM BST, Miguel Ojeda wrote:
> From: Antoni Boucher <[email protected]>
> 
> When using the Rust GCC backend (i.e. `rustc_codegen_gcc`), GCC does not
> inline enough these `Bounded::from_expr` calls:
> 
>     /usr/bin/x86_64-linux-gnu-ld.bfd: rust/kernel.o: in function `<kernel::num::bounded::Bounded<u16, 2> as core::convert::From<kernel::bitfield::tests::Priority>>::from':
>     fake.c:(.text.unlikely+0x7be): undefined reference to `rust_build_error'
> 
>     /usr/bin/x86_64-linux-gnu-ld.bfd: rust/kernel.o: in function `<kernel::num::bounded::Bounded<u64, 4> as core::convert::From<kernel::bitfield::tests::MemoryType>>::from':
>     fake.c:(.text.unlikely+0x90d): undefined reference to `rust_build_error'
> 
> Thus, similar to commit bc197e24a3ac ("rust: num: bounded: Always inline
> fits_within and from_expr"), mark them as `#[inline(always)]`.
> 
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Antoni Boucher <[email protected]>
> [ Reworded to add the error and to follow our usual style and sent on
>   behalf of Antoni, who found this during his work to support Rust for
>   Linux with the GCC backend, i.e. with `rustc_codegen_gcc`.- Miguel ]
> Signed-off-by: Miguel Ojeda <[email protected]>

Reviewed-by: Gary Guo <[email protected]>

> ---
>  rust/kernel/bitfield.rs | 2 ++
>  1 file changed, 2 insertions(+)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.