@@ -65,6 +65,10 @@ core-cfgs = \
6565
6666core-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 \
106111rustdoc-macros : private rustdoc_host = yes
107112rustdoc-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.
114119rustdoc-core : private skip_flags = --edition=2021 -Wrustdoc::unescaped_backticks
115120rustdoc-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
119124rustdoc-compiler_builtins : $(src ) /compiler_builtins.rs rustdoc-core FORCE
@@ -125,7 +130,8 @@ rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE
125130rustdoc-pin_init_internal : private rustdoc_host = yes
126131rustdoc-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
131137rustdoc-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+
146155quiet_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