Re: [PATCH 3/6] rust: add `bitfield!` macro

From: Dirk Behme

Date: Tue Jan 20 2026 - 07:47:55 EST


On 20/01/2026 13:37, Miguel Ojeda wrote:
On Tue, Jan 20, 2026 at 12:45 PM Dirk Behme <dirk.behme@xxxxxxxxxxxx> wrote:

What have I missed?

I think the patch is missing enabling the (already stable by now)
feature. If you add it at the top of `rust/kernel/lib.rs`, does it
work for you?

Yes :)

And I think we need the same for the doctests where it fails as well then:

error[E0747]: type provided when a constant was expected
--> rust/doctests_kernel_generated.rs:2758:1
|
2758 | / bitfield! {
2759 | | pub struct Config(u8) {
2760 | | 3:0 nibble;
2761 | | }
2762 | | }
| |_^
|
= help: const arguments cannot yet be inferred with `_`
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this error originates in the macro `::kernel::bitfield` which comes from the expansion of the macro `bitfield` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0747]: type provided when a constant was expected
--> rust/doctests_kernel_generated.rs:2846:1
|
2846 | / bitfield! {
2847 | | pub struct Control(u32) {
2848 | | 0:0 power => Power;
2849 | | }
2850 | | }
| |_^
|
= help: const arguments cannot yet be inferred with `_`
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this error originates in the macro `::kernel::bitfield` which comes from the expansion of the macro `bitfield` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0747]: type provided when a constant was expected
--> rust/doctests_kernel_generated.rs:2934:41
|
2934 | Mode::Low => Bounded::<u32, _>::new::<0>(),
| ^
|
= help: const arguments cannot yet be inferred with `_`
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable

...


Thanks!

Dirk