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: quote: 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-15-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+43 -3
+1
Makefile
··· 1834 1834 $(Q)find $(srctree) $(RCS_FIND_IGNORE) \ 1835 1835 \( \ 1836 1836 -path $(srctree)/rust/proc-macro2 \ 1837 + -o -path $(srctree)/rust/quote \ 1837 1838 \) -prune -o \ 1838 1839 -type f -a -name '*.rs' -a ! -name '*generated*' -print \ 1839 1840 | xargs $(RUSTFMT) $(rustfmt_flags)
+35 -3
rust/Makefile
··· 27 27 28 28 obj-$(CONFIG_RUST) += exports.o 29 29 30 - always-$(CONFIG_RUST) += libproc_macro2.rlib 30 + always-$(CONFIG_RUST) += libproc_macro2.rlib libquote.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 ··· 89 89 -Zcrate-attr='feature(proc_macro_byte_character,proc_macro_c_str_literals)' \ 90 90 $(call cfgs-to-flags,$(proc_macro2-cfgs)) 91 91 92 + quote-cfgs := \ 93 + feature="proc-macro" 94 + 95 + quote-skip_flags := \ 96 + --edition=2021 97 + 98 + quote-flags := \ 99 + --edition=2018 \ 100 + --cap-lints=allow \ 101 + --extern proc_macro2 \ 102 + $(call cfgs-to-flags,$(quote-cfgs)) 103 + 92 104 # `rustdoc` did not save the target modifiers, thus workaround for 93 105 # the time being (https://github.com/rust-lang/rust/issues/144521). 94 106 rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18) ··· 155 143 rustdoc-proc_macro2: $(src)/proc-macro2/lib.rs rustdoc-clean FORCE 156 144 +$(call if_changed,rustdoc) 157 145 146 + rustdoc-quote: private rustdoc_host = yes 147 + rustdoc-quote: private rustc_target_flags = $(quote-flags) 148 + rustdoc-quote: private skip_flags = $(quote-skip_flags) 149 + rustdoc-quote: $(src)/quote/lib.rs rustdoc-clean rustdoc-proc_macro2 FORCE 150 + +$(call if_changed,rustdoc) 151 + 158 152 rustdoc-macros: private rustdoc_host = yes 159 153 rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \ 160 154 --extern proc_macro 161 - rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean rustdoc-proc_macro2 FORCE 155 + rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean rustdoc-proc_macro2 \ 156 + rustdoc-quote FORCE 162 157 +$(call if_changed,rustdoc) 163 158 164 159 # Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should ··· 224 205 225 206 rusttestlib-proc_macro2: private rustc_target_flags = $(proc_macro2-flags) 226 207 rusttestlib-proc_macro2: $(src)/proc-macro2/lib.rs FORCE 208 + +$(call if_changed,rustc_test_library) 209 + 210 + rusttestlib-quote: private skip_flags = $(quote-skip_flags) 211 + rusttestlib-quote: private rustc_target_flags = $(quote-flags) 212 + rusttestlib-quote: $(src)/quote/lib.rs rusttestlib-proc_macro2 FORCE 227 213 +$(call if_changed,rustc_test_library) 228 214 229 215 rusttestlib-macros: private rustc_target_flags = --extern proc_macro ··· 482 458 $(obj)/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE 483 459 +$(call if_changed_dep,rustc_procmacrolibrary) 484 460 461 + $(obj)/libquote.rlib: private skip_clippy = 1 462 + $(obj)/libquote.rlib: private skip_flags = $(quote-skip_flags) 463 + $(obj)/libquote.rlib: private rustc_target_flags = $(quote-flags) 464 + $(obj)/libquote.rlib: $(src)/quote/lib.rs $(obj)/libproc_macro2.rlib FORCE 465 + +$(call if_changed_dep,rustc_procmacrolibrary) 466 + 485 467 quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@ 486 468 cmd_rustc_procmacro = \ 487 469 $(RUSTC_OR_CLIPPY) $(rust_common_flags) $(rustc_target_flags) \ ··· 499 469 @$(objtree)/include/generated/rustc_cfg $< 500 470 501 471 # Procedural macros can only be used with the `rustc` that compiled it. 502 - $(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/libproc_macro2.rlib FORCE 472 + $(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/libproc_macro2.rlib \ 473 + $(obj)/libquote.rlib FORCE 503 474 +$(call if_changed_dep,rustc_procmacro) 504 475 505 476 $(obj)/$(libpin_init_internal_name): private rustc_target_flags = --cfg kernel ··· 524 493 $(Q)MAKEFLAGS= $(srctree)/scripts/generate_rust_analyzer.py \ 525 494 --cfgs='core=$(core-cfgs)' $(core-edition) \ 526 495 --cfgs='proc_macro2=$(proc_macro2-cfgs)' \ 496 + --cfgs='quote=$(quote-cfgs)' \ 527 497 $(realpath $(srctree)) $(realpath $(objtree)) \ 528 498 $(rustc_sysroot) $(RUST_LIB_SRC) $(if $(KBUILD_EXTMOD),$(srcroot)) \ 529 499 > rust-project.json
+7
scripts/generate_rust_analyzer.py
··· 94 94 ) 95 95 96 96 append_crate( 97 + "quote", 98 + srctree / "rust" / "quote" / "lib.rs", 99 + ["alloc", "proc_macro", "proc_macro2"], 100 + cfg=crates_cfgs["quote"], 101 + ) 102 + 103 + append_crate( 97 104 "macros", 98 105 srctree / "rust" / "macros" / "lib.rs", 99 106 ["std", "proc_macro"],