linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE
@ 2024-04-22  9:12 Miguel Ojeda
  2024-04-22  9:25 ` Alice Ryhl
  2024-04-23  0:42 ` Miguel Ojeda
  0 siblings, 2 replies; 3+ messages in thread
From: Miguel Ojeda @ 2024-04-22  9:12 UTC (permalink / raw)
  To: Masahiro Yamada, Miguel Ojeda, Wedson Almeida Filho, Alex Gaynor
  Cc: Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, David Gow, Brendan Higgins, linux-kbuild,
	rust-for-linux, kunit-dev, linux-kselftest, linux-kernel,
	patches, stable

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].

Cc: stable@vger.kernel.org
Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
Link: https://github.com/rust-lang/rust/issues/122722 [1]
Link: https://github.com/rust-lang/rust/pull/122840 [2]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 rust/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/rust/Makefile b/rust/Makefile
index 846e6ab9d5a9..86a125c4243c 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -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
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE
  2024-04-22  9:12 [PATCH] kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE Miguel Ojeda
@ 2024-04-22  9:25 ` Alice Ryhl
  2024-04-23  0:42 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Alice Ryhl @ 2024-04-22  9:25 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Masahiro Yamada, Wedson Almeida Filho, Alex Gaynor,
	Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	David Gow, Brendan Higgins, linux-kbuild, rust-for-linux,
	kunit-dev, linux-kselftest, linux-kernel, patches, stable

On Mon, Apr 22, 2024 at 11:13 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> 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].
>
> Cc: stable@vger.kernel.org
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Link: https://github.com/rust-lang/rust/issues/122722 [1]
> Link: https://github.com/rust-lang/rust/pull/122840 [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE
  2024-04-22  9:12 [PATCH] kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE Miguel Ojeda
  2024-04-22  9:25 ` Alice Ryhl
@ 2024-04-23  0:42 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2024-04-23  0:42 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Masahiro Yamada, Wedson Almeida Filho, Alex Gaynor,
	Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, David Gow, Brendan Higgins, linux-kbuild,
	rust-for-linux, kunit-dev, linux-kselftest, linux-kernel,
	patches, stable

On Mon, Apr 22, 2024 at 11:13 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> 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].
>
> Cc: stable@vger.kernel.org
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Link: https://github.com/rust-lang/rust/issues/122722 [1]
> Link: https://github.com/rust-lang/rust/pull/122840 [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

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

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-23  0:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22  9:12 [PATCH] kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE Miguel Ojeda
2024-04-22  9:25 ` Alice Ryhl
2024-04-23  0:42 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).