[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCDVIR91LFHQ.1C87G5A0OBJ39@kernel.org>
Date: Thu, 28 Aug 2025 09:14:14 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>, "Jesung Yang" <y.j3ms.n@...il.com>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>,
"Alexandre Courbot" <acourbot@...dia.com>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, <nouveau@...ts.freedesktop.org>
Subject: Re: [PATCH v2 2/5] rust: macros: extend custom `quote!()` macro
On Thu Aug 28, 2025 at 8:39 AM CEST, Alice Ryhl wrote:
> On Fri, Aug 15, 2025 at 7:32 AM Jesung Yang <y.j3ms.n@...il.com> wrote:
>> + (@proc $v:ident $span:ident == $($tt:tt)*) => {
>> + $v.push(::proc_macro::TokenTree::Punct(
>> + ::proc_macro::Punct::new('=', ::proc_macro::Spacing::Joint)
>> + ));
>> + $v.push(::proc_macro::TokenTree::Punct(
>> + ::proc_macro::Punct::new('=', ::proc_macro::Spacing::Alone)
>> + ));
>> + quote_spanned!(@proc $v $span $($tt)*);
>
> Not a blocker, but if the way to implement this one is to push =
> twice, then I think the pattern should just be a single = and then you
> push a = once. The pattern can match twice to handle ==.
You can't do that, since the first one needs the `Joint` spacing and the
second one the `Alone` one. `==` also is a single token in macro input,
so matching only on `=` doesn't work.
---
Cheers,
Benno
Powered by blists - more mailing lists