On Mon Feb 23, 2026 at 10:13 AM JST, Joel Fernandes wrote:
>>> +macro_rules! clist_create {
>>> +    ($head:expr, $rust_type:ty, $c_type:ty, $($field:tt).+) => {{
>>> +        // Compile-time check that field path is a list_head.
>>> +        let _: fn(*const $c_type) -> *const $crate::bindings::list_head =
>>> +            |p| &raw const (*p).$($field).+;
>>> +
>>> +        // Calculate offset and create `CList`.
>>> +        const OFFSET: usize = ::core::mem::offset_of!($c_type, 
>>> $($field).+);
>>> +        $crate::ffi::clist::CList::<$rust_type, OFFSET>::from_raw($head)
>>> +    }};
>>> +}
>> 
>> This uses offset_of! in a way that requires the offset_of_nested
>> feature, so it doesn't build in rust 1.78.0. The feature is already
>> added to rust_allowed_features, so I think it's ok to add
>> #![feature(offset_of_nested)].
>
> Maybe I am missing something, but why should the feature be gated behind
> that if all compiler versions (>= 1.78) support it either in a stable way
> or via an unstable feature flag?

I think that's why it's in rust_allowed_features. IIUC that's where we
put unstable features that are stable enough in all supported compiler
versions to be used.

But, rust_allowed_features doesn't apply to the code here, so you'd have
to add an allow to rust/kernel/lib.rs.

Reply via email to