From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5018F219A8E; Tue, 16 Dec 2025 09:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765878478; cv=none; b=KY4meiOnAf6v5a5XbqVVaMBi0OzI97ALXmWIEX5AeUbPSyaSai00n3iRQNWVkN3FTE+JyAlp44gEeYdWZa7ida9i4bUxaLoBxRA+7EXLMHtStA5D8FU5Bde++vBevvD/ZAADKuVU6WlrpjmCTiNK/0HERgFJv3PGlWstIpYbwNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765878478; c=relaxed/simple; bh=doVzXgniW8zc2KcAcGi0KSPD8+Sd3f6BFM/+QMKljBE=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=tARXSAyuCpskFFd2+30iwBzn1+SR/o72uaGynDhA9kyOTh9f/uYeDGxO2LsuSvhNWxYxh6FA1fNlCjltQhWs1/qhQwmtKZxl0xRHGLhyZW+xn5VegPMZ0yjBzuadFg2V19LTT+8a9UAU+W66/Om7p36U3l0Poo9rJFW3wKnMnC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=APpKDzVH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="APpKDzVH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5F08C4CEF1; Tue, 16 Dec 2025 09:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765878477; bh=doVzXgniW8zc2KcAcGi0KSPD8+Sd3f6BFM/+QMKljBE=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=APpKDzVHxF/oYIoFPMkfk+a1SoB3FNTuLkyP6XERl+KKfTO5GOFKysg1H8AIOqzWc ZlS+yVq0veVxFKfs9TCo0QTbCcxV2scZyRoNyp/xCnDOUum7FsHPzxonSEM0CEFukn jVDqz/V2gtE+sJmxS9ZCpn5pdr2yzF1boLD2DeuihxV1YzdQdUAyAxiimNDrNScKUB MgNB2gdxtm9wo5wz07l0UFD9ZHMoi2yW5Oh0anuLVHVEEkiA5WVa0XIFAreg8ZDqmI nawvgaahTyQzsLLArZGYlrkiFmIGQe2qtIBnvpbcELbYBlWy9M27vn1VRxagc5pgP5 0SJpkHX19PxSQ== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 16 Dec 2025 10:47:51 +0100 Message-Id: Cc: , , , Subject: Re: [PATCH 02/11] rust: macros: use `quote!` from vendored crate From: "Benno Lossin" To: "Gary Guo" , "Miguel Ojeda" , "Boqun Feng" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Danilo Krummrich" , "Brendan Higgins" , "David Gow" , "Rae Moar" , "Greg Kroah-Hartman" , "Tamir Duberstein" , "Fiona Behrens" , "Igor Korotin" , =?utf-8?q?Jos=C3=A9_Exp=C3=B3sito?= , "Guilherme Giacomo Simoes" X-Mailer: aerc 0.21.0 References: <20251211185805.2835633-1-gary@kernel.org> <20251211185805.2835633-3-gary@kernel.org> In-Reply-To: <20251211185805.2835633-3-gary@kernel.org> On Thu Dec 11, 2025 at 7:56 PM CET, Gary Guo wrote: > From: Gary Guo > > 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 Reviewed-by: Benno Lossin > --- > 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() > } > =20 > /// 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 =3D input.into_iter().collect(); > + let mut tokens =3D proc_macro2::TokenStream::from(input).into_iter()= .collect(); > paste::expand(&mut tokens); > - tokens.into_iter().collect() > + tokens > + .into_iter() > + .collect::() > + .into() There is no `FromIterator` impl on `proc_macro::TokenStream`? Sad :( Cheers, Benno > } > =20 > /// Registers a KUnit test suite and its test cases using a user-space l= ike syntax.