[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DFQ5STPL7L5L.2HEHEF8VDFFP9@kernel.org>
Date: Fri, 16 Jan 2026 17:37:29 +0100
From: "Benno Lossin" <lossin@...nel.org>
To: "Tamir Duberstein" <tamird@...il.com>
Cc: "Gary Guo" <gary@...yguo.net>, "Miguel Ojeda" <ojeda@...nel.org>, "Boqun
Feng" <boqun.feng@...il.com>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
"Danilo Krummrich" <dakr@...nel.org>, "Fiona Behrens" <me@...enk.dev>,
"Christian Schrefl" <chrisi.schrefl@...il.com>, "Alban Kurti"
<kurti@...icto.ai>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v3 09/15] rust: pin-init: rewrite the initializer macros
using `syn`
On Fri Jan 16, 2026 at 4:39 PM CET, Tamir Duberstein wrote:
> On Fri, Jan 16, 2026 at 4:28 AM Benno Lossin <lossin@...nel.org> wrote:
>>
>> On Fri Jan 16, 2026 at 1:19 AM CET, Tamir Duberstein wrote:
>> > On Thu, Jan 15, 2026 at 5:43 PM Benno Lossin <lossin@...nel.org> wrote:
>> >>
>> >> On Thu Jan 15, 2026 at 10:45 PM CET, Tamir Duberstein wrote:
>> >> > On Wed, Jan 14, 2026 at 1:20 PM Benno Lossin <lossin@...nel.org> wrote:
>> >> >>
>> >> >> Rewrite the initializer macros `[pin_]init!` using `syn`. No functional
>> >> >> changes intended aside from improved error messages on syntactic and
>> >> >> semantical errors. For example if one forgets to use `<-` with an
>> >> >> initializer (and instead uses `:`):
>> >> >>
>> >> >> <snip>
>> >> >>
>> >> >> Tested-by: Andreas Hindborg <a.hindborg@...nel.org>
>> >> >> Signed-off-by: Benno Lossin <lossin@...nel.org>
>> >> >> ---
>> >> >>
>> >> >> <snip>
>> >> >>
>> >> >> -#[cfg(kernel)]
>> >> >> -pub use ::macros::paste;
>> >> >> -#[cfg(not(kernel))]
>> >> >> -pub use ::paste::paste;
>> >> >
>> >> > Now that `cfg(kernel)` is gone, can we also remove it from `rust/Makefile`
>> >> > and `scripts/generate_rust_analyzer.py`? That is already done for
>> >> > pin-init in patch 3 of this series:
>> >> > https://lore.kernel.org/all/20260114181934.1782470-4-lossin@kernel.org/.
>> >>
>> >> I'm still using `cfg(kernel)` in `src/lib.rs` for linking to the std
>> >> Box and Arc types.
>> >
>> > Are you sure? I'm not seeing it. It looks like the crate is no_std
>> > unless the std feature is activated and no features are activated in
>> > the kernel.
>>
>> Yes:
>>
>> $ rg 'cfg.*kernel'
>>
>> src/lib.rs
>> 260:#![cfg_attr(not(kernel), doc = "[`Arc<T>`]: alloc::alloc::sync::Arc")]
>> 261:#![cfg_attr(not(kernel), doc = "[`Box<T>`]: alloc::alloc::boxed::Box")]
>> 921:#[cfg_attr(not(kernel), doc = "[`Arc<T>`]: alloc::alloc::sync::Arc")]
>> 922:#[cfg_attr(not(kernel), doc = "[`Box<T>`]: alloc::alloc::boxed::Box")]
>> 1020:#[cfg_attr(not(kernel), doc = "[`Arc<T>`]: alloc::alloc::sync::Arc")]
>> 1021:#[cfg_attr(not(kernel), doc = "[`Box<T>`]: alloc::alloc::boxed::Box")]
>>
>> >> Also I don't want to have to reintroduce all that infrastructure when I
>> >> inevitably have to add new kernel workarounds.
>> >
>> > Then why remove it for pin-init?
>>
>> I don't understand, what is removed where? In patch 3 the `--cfg kernel`
>> is kept in all locations.
>
> You're right, I must've misread. It's fine to keep & sorry for the noise.
Don't worry, I appreciate you taking a look :)
Cheers,
Benno
Powered by blists - more mailing lists