Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: syn: 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.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
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-20-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+42 -3
+1
Makefile
··· 1835 1835 \( \ 1836 1836 -path $(srctree)/rust/proc-macro2 \ 1837 1837 -o -path $(srctree)/rust/quote \ 1838 + -o -path $(srctree)/rust/syn \ 1838 1839 \) -prune -o \ 1839 1840 -type f -a -name '*.rs' -a ! -name '*generated*' -print \ 1840 1841 | xargs $(RUSTFMT) $(rustfmt_flags)
+34 -3
rust/Makefile
··· 27 27 28 28 obj-$(CONFIG_RUST) += exports.o 29 29 30 - always-$(CONFIG_RUST) += libproc_macro2.rlib libquote.rlib 30 + always-$(CONFIG_RUST) += libproc_macro2.rlib libquote.rlib libsyn.rlib 31 31 32 32 always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.rs 33 33 always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c ··· 101 101 --extern proc_macro2 \ 102 102 $(call cfgs-to-flags,$(quote-cfgs)) 103 103 104 + # `extra-traits`, `fold` and `visit` may be enabled if needed. 105 + syn-cfgs := \ 106 + feature="clone-impls" \ 107 + feature="derive" \ 108 + feature="full" \ 109 + feature="parsing" \ 110 + feature="printing" \ 111 + feature="proc-macro" \ 112 + feature="visit-mut" 113 + 114 + syn-flags := \ 115 + --cap-lints=allow \ 116 + --extern proc_macro2 \ 117 + --extern quote \ 118 + $(call cfgs-to-flags,$(syn-cfgs)) 119 + 104 120 # `rustdoc` did not save the target modifiers, thus workaround for 105 121 # the time being (https://github.com/rust-lang/rust/issues/144521). 106 122 rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18) ··· 177 161 rustdoc-quote: $(src)/quote/lib.rs rustdoc-clean rustdoc-proc_macro2 FORCE 178 162 +$(call if_changed,rustdoc) 179 163 164 + rustdoc-syn: private rustdoc_host = yes 165 + rustdoc-syn: private rustc_target_flags = $(syn-flags) 166 + rustdoc-syn: $(src)/syn/lib.rs rustdoc-clean rustdoc-quote FORCE 167 + +$(call if_changed,rustdoc) 168 + 180 169 rustdoc-macros: private rustdoc_host = yes 181 170 rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \ 182 171 --extern proc_macro 183 172 rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean rustdoc-proc_macro2 \ 184 - rustdoc-quote FORCE 173 + rustdoc-quote rustdoc-syn FORCE 185 174 +$(call if_changed,rustdoc) 186 175 187 176 # Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should ··· 250 229 rusttestlib-quote: private skip_flags = $(quote-skip_flags) 251 230 rusttestlib-quote: private rustc_target_flags = $(quote-flags) 252 231 rusttestlib-quote: $(src)/quote/lib.rs rusttestlib-proc_macro2 FORCE 232 + +$(call if_changed,rustc_test_library) 233 + 234 + rusttestlib-syn: private rustc_target_flags = $(syn-flags) 235 + rusttestlib-syn: $(src)/syn/lib.rs rusttestlib-quote FORCE 253 236 +$(call if_changed,rustc_test_library) 254 237 255 238 rusttestlib-macros: private rustc_target_flags = --extern proc_macro ··· 513 488 $(obj)/libquote.rlib: $(src)/quote/lib.rs $(obj)/libproc_macro2.rlib FORCE 514 489 +$(call if_changed_dep,rustc_procmacrolibrary) 515 490 491 + $(obj)/libsyn.rlib: private skip_clippy = 1 492 + $(obj)/libsyn.rlib: private rustc_target_flags = $(syn-flags) 493 + $(obj)/libsyn.rlib: $(src)/syn/lib.rs $(obj)/libquote.rlib FORCE 494 + +$(call if_changed_dep,rustc_procmacrolibrary) 495 + 516 496 quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@ 517 497 cmd_rustc_procmacro = \ 518 498 $(RUSTC_OR_CLIPPY) $(rust_common_flags) $(rustc_target_flags) \ ··· 530 500 531 501 # Procedural macros can only be used with the `rustc` that compiled it. 532 502 $(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/libproc_macro2.rlib \ 533 - $(obj)/libquote.rlib FORCE 503 + $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE 534 504 +$(call if_changed_dep,rustc_procmacro) 535 505 536 506 $(obj)/$(libpin_init_internal_name): private rustc_target_flags = --cfg kernel ··· 555 525 --cfgs='core=$(core-cfgs)' $(core-edition) \ 556 526 --cfgs='proc_macro2=$(proc_macro2-cfgs)' \ 557 527 --cfgs='quote=$(quote-cfgs)' \ 528 + --cfgs='syn=$(syn-cfgs)' \ 558 529 $(realpath $(srctree)) $(realpath $(objtree)) \ 559 530 $(rustc_sysroot) $(RUST_LIB_SRC) $(if $(KBUILD_EXTMOD),$(srcroot)) \ 560 531 > rust-project.json
+7
scripts/generate_rust_analyzer.py
··· 101 101 ) 102 102 103 103 append_crate( 104 + "syn", 105 + srctree / "rust" / "syn" / "lib.rs", 106 + ["proc_macro", "proc_macro2", "quote"], 107 + cfg=crates_cfgs["syn"], 108 + ) 109 + 110 + append_crate( 104 111 "macros", 105 112 srctree / "rust" / "macros" / "lib.rs", 106 113 ["std", "proc_macro"],