summaryrefslogtreecommitdiff
path: root/scripts/generate_rust_analyzer.py
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2025-11-24 16:18:22 +0100
committerMiguel Ojeda <ojeda@kernel.org>2025-11-24 17:15:41 +0100
commit158a3b72118a4dab7e7bf2d89afbab9b96eddc1c (patch)
treec8355dd9fb242b2b06b848c4df460e433d8d6c8c /scripts/generate_rust_analyzer.py
parentbc1565efc358553d7be23a09fe012560402b7151 (diff)
rust: proc-macro2: enable support in kbuild
With all the new files in place and ready from the new crate, enable the support for it in the build system. `proc_macro_byte_character` and `proc_macro_c_str_literals` were stabilized in Rust 1.79.0 [1] and were implemented earlier than our minimum Rust version (1.78) [2][3]. Thus just enable them instead of using the `cfg` that `proc-macro2` uses to emulate them in older compilers. In addition, skip formatting for this vendored crate and take the chance to add a comment mentioning this. Link: https://github.com/rust-lang/rust/pull/123431 [1] Link: https://github.com/rust-lang/rust/pull/112711 [2] Link: https://github.com/rust-lang/rust/pull/119651 [3] Reviewed-by: Gary Guo <gary@garyguo.net> Tested-by: Gary Guo <gary@garyguo.net> Tested-by: Jesung Yang <y.j3ms.n@gmail.com> Link: https://patch.msgid.link/20251124151837.2184382-11-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
-rwxr-xr-xscripts/generate_rust_analyzer.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index dedca470adc1..00c6b7cc94b7 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -87,6 +87,13 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
)
append_crate(
+ "proc_macro2",
+ srctree / "rust" / "proc-macro2" / "lib.rs",
+ ["core", "alloc", "std", "proc_macro"],
+ cfg=crates_cfgs["proc_macro2"],
+ )
+
+ append_crate(
"macros",
srctree / "rust" / "macros" / "lib.rs",
["std", "proc_macro"],