lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DF4JBGAGVKYW.367WAXDU2B0B1@kernel.org>
Date: Mon, 22 Dec 2025 07:34:24 +0100
From: "Benno Lossin" <lossin@...nel.org>
To: "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>,
 "Guilherme Giacomo Simoes" <trintaeoitogc@...il.com>,
 José Expósito <jose.exposito89@...il.com>, "Tamir
 Duberstein" <tamird@...il.com>
Cc: <rust-for-linux@...r.kernel.org>, "David Gow" <davidgow@...gle.com>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/11] rust: macros: convert `concat_idents!` to use
 `syn`

On Thu Dec 11, 2025 at 7:56 PM CET, Gary Guo wrote:
> From: Gary Guo <gary@...yguo.net>
>
> This eliminates the need for `expect_punct` helper.

This commit message could use some more details :)

> Signed-off-by: Gary Guo <gary@...yguo.net>

Reviewed-by: Benno Lossin <lossin@...nel.org>

> ---
>  rust/macros/concat_idents.rs | 39 ++++++++++++++++++++++++------------
>  rust/macros/helpers.rs       | 14 +------------
>  rust/macros/lib.rs           |  4 ++--
>  3 files changed, 29 insertions(+), 28 deletions(-)

> -pub(crate) fn concat_idents(ts: TokenStream) -> TokenStream {
> -    let mut it = ts.into_iter();
> -    let a = expect_ident(&mut it);
> -    assert_eq!(expect_punct(&mut it), ',');
> -    let b = expect_ident(&mut it);
> -    assert!(it.next().is_none(), "only two idents can be concatenated");
> +pub(crate) fn concat_idents(Input { a, b, .. }: Input) -> TokenStream {
>      let res = Ident::new(&format!("{a}{b}"), b.span());

There is `quote::format_ident!`, which directly returns an identifier,
but with the span of the first of the two. Not sure if that is better.

Cheers,
Benno

>      TokenStream::from_iter([TokenTree::Ident(res)])
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ