@@ -65,6 +65,10 @@ core-cfgs = \
65
65
66
66
core-edition := $(if $(call rustc-min-version,108700) ,2024,2021)
67
67
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
+
68
72
# `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only
69
73
# since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust
70
74
# 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, ) $<
77
81
-Zunstable-options --generate-link-to-definition \
78
82
--output $(rustdoc_output ) \
79
83
--crate-name $(subst rustdoc-,,$@ ) \
84
+ $(rustdoc_modifiers_workaround ) \
80
85
$(if $(rustdoc_host ) ,,--sysroot=/dev/null) \
81
86
@$(objtree ) /include/generated/rustc_cfg $<
82
87
@@ -106,14 +111,14 @@ rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
106
111
rustdoc-macros : private rustdoc_host = yes
107
112
rustdoc-macros : private rustc_target_flags = --crate-type proc-macro \
108
113
--extern proc_macro
109
- rustdoc-macros : $(src ) /macros/lib.rs FORCE
114
+ rustdoc-macros : $(src ) /macros/lib.rs rustdoc-clean FORCE
110
115
+$(call if_changed,rustdoc)
111
116
112
117
# Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should
113
118
# not be needed -- see https://github.com/rust-lang/rust/pull/128307.
114
119
rustdoc-core : private skip_flags = --edition=2021 -Wrustdoc::unescaped_backticks
115
120
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
117
122
+$(call if_changed,rustdoc)
118
123
119
124
rustdoc-compiler_builtins : $(src ) /compiler_builtins.rs rustdoc-core FORCE
@@ -125,7 +130,8 @@ rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE
125
130
rustdoc-pin_init_internal : private rustdoc_host = yes
126
131
rustdoc-pin_init_internal : private rustc_target_flags = --cfg kernel \
127
132
--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
129
135
+$(call if_changed,rustdoc)
130
136
131
137
rustdoc-pin_init : private rustdoc_host = yes
@@ -143,6 +149,9 @@ rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-ffi rustdoc-macros \
143
149
$(obj)/bindings.o FORCE
144
150
+$(call if_changed,rustdoc)
145
151
152
+ rustdoc-clean : FORCE
153
+ $(Q ) rm -rf $(rustdoc_output )
154
+
146
155
quiet_cmd_rustc_test_library = $(RUSTC_OR_CLIPPY_QUIET ) TL $<
147
156
cmd_rustc_test_library = \
148
157
OBJTREE=$(abspath $(objtree ) ) \
@@ -215,6 +224,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
215
224
--extern bindings --extern uapi \
216
225
--no-run --crate-name kernel -Zunstable-options \
217
226
--sysroot=/dev/null \
227
+ $(rustdoc_modifiers_workaround ) \
218
228
--test-builder $(objtree ) /scripts/rustdoc_test_builder \
219
229
$< $(rustdoc_test_kernel_quiet ) ; \
220
230
$(objtree ) /scripts/rustdoc_test_gen
0 commit comments