From: Miguel Ojeda <ojeda@kernel.org>
To: Miguel Ojeda <ojeda@kernel.org>,
Alex Gaynor <alex.gaynor@gmail.com>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, patches@lists.linux.dev,
"Jesung Yang" <y.j3ms.n@gmail.com>
Subject: [PATCH v2 20/20] rust: macros: support `proc-macro2`, `quote` and `syn`
Date: Mon, 24 Nov 2025 16:18:32 +0100 [thread overview]
Message-ID: <20251124151837.2184382-21-ojeda@kernel.org> (raw)
In-Reply-To: <20251124151837.2184382-1-ojeda@kernel.org>
One of the two main uses cases for adding `proc-macro2`, `quote` and
`syn` is the `macros` crates (and the other `pin-init`).
Thus add the support for the crates in `macros` already.
Tested-by: Jesung Yang <y.j3ms.n@gmail.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
rust/Makefile | 13 +++++++++----
scripts/generate_rust_analyzer.py | 2 +-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/rust/Makefile b/rust/Makefile
index 8988ecf32531..d7d19c21b671 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -184,7 +184,7 @@ rustdoc-syn: $(src)/syn/lib.rs rustdoc-clean rustdoc-quote FORCE
rustdoc-macros: private rustdoc_host = yes
rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
- --extern proc_macro
+ --extern proc_macro --extern proc_macro2 --extern quote --extern syn
rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean rustdoc-proc_macro2 \
rustdoc-quote rustdoc-syn FORCE
+$(call if_changed,rustdoc)
@@ -256,9 +256,11 @@ rusttestlib-syn: private rustc_target_flags = $(syn-flags)
rusttestlib-syn: $(src)/syn/lib.rs rusttestlib-quote FORCE
+$(call if_changed,rustc_test_library)
-rusttestlib-macros: private rustc_target_flags = --extern proc_macro
+rusttestlib-macros: private rustc_target_flags = --extern proc_macro \
+ --extern proc_macro2 --extern quote --extern syn
rusttestlib-macros: private rustc_test_library_proc = yes
-rusttestlib-macros: $(src)/macros/lib.rs FORCE
+rusttestlib-macros: $(src)/macros/lib.rs \
+ rusttestlib-proc_macro2 rusttestlib-quote rusttestlib-syn FORCE
+$(call if_changed,rustc_test_library)
rusttestlib-pin_init_internal: private rustc_target_flags = --cfg kernel \
@@ -339,7 +341,8 @@ quiet_cmd_rustc_test = $(RUSTC_OR_CLIPPY_QUIET) T $<
rusttest: rusttest-macros
rusttest-macros: private rustc_target_flags = --extern proc_macro \
- --extern macros --extern kernel --extern pin_init
+ --extern macros --extern kernel --extern pin_init \
+ --extern proc_macro2 --extern quote --extern syn
rusttest-macros: private rustdoc_test_target_flags = --crate-type proc-macro
rusttest-macros: $(src)/macros/lib.rs \
rusttestlib-macros rusttestlib-kernel rusttestlib-pin_init FORCE
@@ -529,6 +532,8 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
@$(objtree)/include/generated/rustc_cfg $<
# Procedural macros can only be used with the `rustc` that compiled it.
+$(obj)/$(libmacros_name): private rustc_target_flags = \
+ --extern proc_macro2 --extern quote --extern syn
$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/libproc_macro2.rlib \
$(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE
+$(call if_changed_dep,rustc_procmacro)
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index 5b6f7b8d6918..147d0cc94068 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -110,7 +110,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
append_crate(
"macros",
srctree / "rust" / "macros" / "lib.rs",
- ["std", "proc_macro"],
+ ["std", "proc_macro", "proc_macro2", "quote", "syn"],
is_proc_macro=True,
)
--
2.52.0
next prev parent reply other threads:[~2025-11-24 15:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 15:18 [PATCH v2 00/20] `syn` support Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 01/20] rust: kbuild: introduce `core-flags` and `core-skip_flags` Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 02/20] rust: kbuild: simplify `--cfg` handling Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 03/20] rust: kbuild: add proc macro library support Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 04/20] rust: kbuild: support skipping flags in `rustc_test_library` Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 05/20] rust: kbuild: support using libraries in `rustc_procmacro` Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 06/20] rust: proc-macro2: import crate Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 07/20] rust: proc-macro2: add SPDX License Identifiers Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 08/20] rust: proc-macro2: remove `unicode_ident` dependency Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 09/20] rust: proc-macro2: add `README.md` Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 10/20] rust: proc-macro2: enable support in kbuild Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 11/20] rust: quote: import crate Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 12/20] rust: quote: add SPDX License Identifiers Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 13/20] rust: quote: add `README.md` Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 14/20] rust: quote: enable support in kbuild Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 15/20] rust: syn: import crate Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 16/20] rust: syn: add SPDX License Identifiers Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 17/20] rust: syn: remove `unicode-ident` dependency Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 18/20] rust: syn: add `README.md` Miguel Ojeda
2025-11-24 15:18 ` [PATCH v2 19/20] rust: syn: enable support in kbuild Miguel Ojeda
2026-01-04 23:17 ` Tamir Duberstein
2026-01-05 4:31 ` Jesung Yang
2025-11-24 15:18 ` Miguel Ojeda [this message]
2025-11-24 16:23 ` [PATCH v2 00/20] `syn` support Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251124151837.2184382-21-ojeda@kernel.org \
--to=ojeda@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=patches@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=y.j3ms.n@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.