Skip to contentSkip to conversation

kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE

PATCH In review Miguel Ojeda 3 participants 3 messages Apr 22, 2024 – Apr 23, 2024

Subsystems (4)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE

When KUnit tests are enabled, under very big kernel configurations (e.g. allyesconfig), we can trigger a rustdoc ICE [1]:

RUSTDOC TK rust/kernel/lib.rs
error: the compiler unexpectedly panicked. this is a bug.

The reason is that this build step has a duplicated @rustc_cfg argument, which contains the kernel configuration, and thus a lot of arguments. The factor 2 happens to be enough to reach the ICE.

Thus remove the unneeded @rustc_cfg. By doing so, we clean up the command and workaround the ICE.

The ICE has been fixed in the upcoming Rust 1.79 [2].

Fixes a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
---
 rust/Makefile | 1 -
 1 file changed, 1 deletion(-)
rust/Makefile +0 -1
index 846e6ab9d5a9..86a125c4243c 100644
@@ -175,7 +175,6 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
 	mkdir -p $(objtree)/$(obj)/test/doctests/kernel; \
 	OBJTREE=$(abspath $(objtree)) \
 	$(RUSTDOC) --test $(rust_flags) \
-		@$(objtree)/include/generated/rustc_cfg \
 		-L$(objtree)/$(obj) --extern alloc --extern kernel \
 		--extern build_error --extern macros \
 		--extern bindings --extern uapi \

base-commit: 4cece764965020c22cff7665b18a012006359095

Signature · 1 line
2.44.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Miguel Ojeda

When KUnit tests are enabled, under very big kernel configurations (e.g. allyesconfig), we can trigger a rustdoc ICE [1]:

RUSTDOC TK rust/kernel/lib.rs
error: the compiler unexpectedly panicked. this is a bug.

The reason is that this build step has a duplicated @rustc_cfg argument, which contains the kernel configuration, and thus a lot of arguments. The factor 2 happens to be enough to reach the ICE.

Thus remove the unneeded @rustc_cfg. By doing so, we clean up the command and workaround the ICE.

Quoted 7 lines

The ICE has been fixed in the upcoming Rust 1.79 [2].

Fixes a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
#2 lore raw
In reply to Miguel Ojeda
Quoted 14 lines · Miguel Ojeda

When KUnit tests are enabled, under very big kernel configurations (e.g. allyesconfig), we can trigger a rustdoc ICE [1]:

RUSTDOC TK rust/kernel/lib.rs
error: the compiler unexpectedly panicked. this is a bug.

The reason is that this build step has a duplicated @rustc_cfg argument, which contains the kernel configuration, and thus a lot of arguments. The factor 2 happens to be enough to reach the ICE.

Thus remove the unneeded @rustc_cfg. By doing so, we clean up the command and workaround the ICE.

Quoted 7 lines

The ICE has been fixed in the upcoming Rust 1.79 [2].

Fixes a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")

Applied to rust-fixes early to start getting some testing in -next. Please feel free to send tags for this one.

Cheers,
Miguel