Skip to content

Commit 99bade3

Browse files
committed
Merge tag 'rust-fixes-6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux
Pull rust fixes from Miguel Ojeda: - Workaround 'rustdoc' target modifiers bug in Rust >= 1.88.0. It will be fixed in Rust 1.90.0 (expected 2025-09-18). - Clean 'rustdoc' output before running it to avoid confusing the tool when files from previous versions remain. * tag 'rust-fixes-6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: rust: kbuild: clean output before running `rustdoc` rust: workaround `rustdoc` target modifiers bug
2 parents 90d970c + 252fea1 commit 99bade3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

rust/Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ core-cfgs = \
6565

6666
core-edition := $(if $(call rustc-min-version,108700),2024,2021)
6767

68+
# `rustdoc` did not save the target modifiers, thus workaround for
69+
# the time being (https://github.com/rust-lang/rust/issues/144521).
70+
rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)
71+
6872
# `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only
6973
# since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust
7074
# 1.82.0 (https://github.com/rust-lang/rust/issues/138520). Thus workaround both
@@ -77,6 +81,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
7781
-Zunstable-options --generate-link-to-definition \
7882
--output $(rustdoc_output) \
7983
--crate-name $(subst rustdoc-,,$@) \
84+
$(rustdoc_modifiers_workaround) \
8085
$(if $(rustdoc_host),,--sysroot=/dev/null) \
8186
@$(objtree)/include/generated/rustc_cfg $<
8287

@@ -106,14 +111,14 @@ rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
106111
rustdoc-macros: private rustdoc_host = yes
107112
rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
108113
--extern proc_macro
109-
rustdoc-macros: $(src)/macros/lib.rs FORCE
114+
rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean FORCE
110115
+$(call if_changed,rustdoc)
111116

112117
# Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should
113118
# not be needed -- see https://github.com/rust-lang/rust/pull/128307.
114119
rustdoc-core: private skip_flags = --edition=2021 -Wrustdoc::unescaped_backticks
115120
rustdoc-core: private rustc_target_flags = --edition=$(core-edition) $(core-cfgs)
116-
rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
121+
rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs rustdoc-clean FORCE
117122
+$(call if_changed,rustdoc)
118123

119124
rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE
@@ -125,7 +130,8 @@ rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE
125130
rustdoc-pin_init_internal: private rustdoc_host = yes
126131
rustdoc-pin_init_internal: private rustc_target_flags = --cfg kernel \
127132
--extern proc_macro --crate-type proc-macro
128-
rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs FORCE
133+
rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs \
134+
rustdoc-clean FORCE
129135
+$(call if_changed,rustdoc)
130136

131137
rustdoc-pin_init: private rustdoc_host = yes
@@ -143,6 +149,9 @@ rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-ffi rustdoc-macros \
143149
$(obj)/bindings.o FORCE
144150
+$(call if_changed,rustdoc)
145151

152+
rustdoc-clean: FORCE
153+
$(Q)rm -rf $(rustdoc_output)
154+
146155
quiet_cmd_rustc_test_library = $(RUSTC_OR_CLIPPY_QUIET) TL $<
147156
cmd_rustc_test_library = \
148157
OBJTREE=$(abspath $(objtree)) \
@@ -215,6 +224,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
215224
--extern bindings --extern uapi \
216225
--no-run --crate-name kernel -Zunstable-options \
217226
--sysroot=/dev/null \
227+
$(rustdoc_modifiers_workaround) \
218228
--test-builder $(objtree)/scripts/rustdoc_test_builder \
219229
$< $(rustdoc_test_kernel_quiet); \
220230
$(objtree)/scripts/rustdoc_test_gen

0 commit comments

Comments
 (0)