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: <DEZJOAT8ERZ5.34R3FCWWNF065@kernel.org>
Date: Tue, 16 Dec 2025 10:47:51 +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>, "Brendan Higgins"
 <brendan.higgins@...ux.dev>, "David Gow" <davidgow@...gle.com>, "Rae Moar"
 <raemoar63@...il.com>, "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
 "Tamir Duberstein" <tamird@...il.com>, "Fiona Behrens" <me@...enk.dev>,
 "Igor Korotin" <igor.korotin.linux@...il.com>,
 José Expósito <jose.exposito89@...il.com>, "Guilherme
 Giacomo Simoes" <trintaeoitogc@...il.com>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <linux-kselftest@...r.kernel.org>, <kunit-dev@...glegroups.com>
Subject: Re: [PATCH 02/11] rust: macros: use `quote!` from vendored crate

On Thu Dec 11, 2025 at 7:56 PM CET, Gary Guo wrote:
> From: Gary Guo <gary@...yguo.net>
>
> With `quote` crate now vendored in the kernel, we can remove our custom
> `quote!` macro implementation and just rely on that crate instead.
>
> The `quote` crate uses types from the `proc-macro2` library so we also
> update to use that, and perform conversion in the top-level lib.rs.
>
> Signed-off-by: Gary Guo <gary@...yguo.net>

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

> ---
>  rust/macros/concat_idents.rs |   2 +-
>  rust/macros/export.rs        |   4 +-
>  rust/macros/fmt.rs           |   4 +-
>  rust/macros/helpers.rs       |   2 +-
>  rust/macros/kunit.rs         |   3 +-
>  rust/macros/lib.rs           |  21 ++--
>  rust/macros/module.rs        |   6 +-
>  rust/macros/paste.rs         |   2 +-
>  rust/macros/quote.rs         | 182 -----------------------------------
>  rust/macros/vtable.rs        |   3 +-
>  10 files changed, 28 insertions(+), 201 deletions(-)
>  delete mode 100644 rust/macros/quote.rs

> @@ -275,7 +273,7 @@ pub fn fmt(input: TokenStream) -> TokenStream {
>  /// ```
>  #[proc_macro]
>  pub fn concat_idents(ts: TokenStream) -> TokenStream {
> -    concat_idents::concat_idents(ts)
> +    concat_idents::concat_idents(ts.into()).into()
>  }
>  
>  /// Paste identifiers together.
> @@ -413,9 +411,12 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
>  /// [`paste`]: https://docs.rs/paste/
>  #[proc_macro]
>  pub fn paste(input: TokenStream) -> TokenStream {
> -    let mut tokens = input.into_iter().collect();
> +    let mut tokens = proc_macro2::TokenStream::from(input).into_iter().collect();
>      paste::expand(&mut tokens);
> -    tokens.into_iter().collect()
> +    tokens
> +        .into_iter()
> +        .collect::<proc_macro2::TokenStream>()
> +        .into()

There is no `FromIterator` impl on `proc_macro::TokenStream`? Sad :(

Cheers,
Benno

>  }
>  
>  /// Registers a KUnit test suite and its test cases using a user-space like syntax.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ