On Thu Dec 11, 2025 at 7:56 PM CET, Gary Guo wrote:
> From: Gary Guo <[email protected]>
>
> 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 <[email protected]>

Reviewed-by: Benno Lossin <[email protected]>

> ---
>  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.

Reply via email to