Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: rustdoc's --test option may call rustc with too many arguments #122722

Closed
ojeda opened this issue Mar 19, 2024 · 2 comments · Fixed by #122840
Closed

ICE: rustdoc's --test option may call rustc with too many arguments #122722

ojeda opened this issue Mar 19, 2024 · 2 comments · Fixed by #122840
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ojeda
Copy link
Contributor

ojeda commented Mar 19, 2024

rustdoc's --test option may call rustc with too many arguments, e.g. due to --cfgs, ICE'ing with:

thread 'x.rs - S (line 1)' panicked at src/librustdoc/doctest.rs:407:38:
Failed to spawn rustc process: Os { code: 7, kind: ArgumentListTooLong, message: "Argument list too long" }

In particular, the original call to rustdoc (i.e. the user's call) may not suffer from this if they used @args to pass many arguments, but rustdoc will then try to spawn rustc passing them as parameters, and thus failing.

A reproducer may look like, for large enough N:

echo -e '//! ```\n//! ```' > x.rs
yes -- --cfg=A | head -n $N > cfgs
rustdoc --test @cfgs x.rs

Since different systems may have different limits, it may be best to have rustdoc use a temporary file for all arguments that come from unbounded lists. Or perhaps using the original @args, if that is possible, since users using too many e.g. --cfgs are probably using them already.

In the kernel we are close to hitting the limit: we have 28k+ --cfgs arguments in big configurations, and we may start soon passing --check-cfgs for those too. Passing our @cfgs twice already hits the limit.

Meta

Can be reproduced with both the latest stable (1.76.0) and the latest nightly (1.79.0-nightly (3c85e56 2024-03-18)).

@ojeda ojeda added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 19, 2024
@jieyouxu jieyouxu added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 19, 2024
@GuillaumeGomez
Copy link
Member

Wow. That's... a lot. ^^'

Should be doable with a tempfile. Taking a look.

@ojeda
Copy link
Contributor Author

ojeda commented Mar 21, 2024

Thanks Guillaume!

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 23, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 23, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 24, 2024
…ny-args, r=notriddle,Urgau,jieyouxu

`rustdoc --test`: Prevent reaching the maximum size of command-line by using files for arguments if there are too many

Fixes rust-lang#122722.

Thanks to this I discovered that rust was using ``@`` to add arguments from a file, quite convenient.

If there are too many `cfg` arguments given to `rustdoc --test`, it'll now put them into a temporary file and passing it as argument to the rustc command.

I added a test with 100_000 `cfg` arguments to ensure it'll not break again.

r? `@notrid`
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 24, 2024
Rollup merge of rust-lang#122840 - GuillaumeGomez:rustdoc-test-too-many-args, r=notriddle,Urgau,jieyouxu

`rustdoc --test`: Prevent reaching the maximum size of command-line by using files for arguments if there are too many

Fixes rust-lang#122722.

Thanks to this I discovered that rust was using ``@`` to add arguments from a file, quite convenient.

If there are too many `cfg` arguments given to `rustdoc --test`, it'll now put them into a temporary file and passing it as argument to the rustc command.

I added a test with 100_000 `cfg` arguments to ensure it'll not break again.

r? `@notrid`
RenjiSann pushed a commit to RenjiSann/rust that referenced this issue Mar 25, 2024
…ny-args, r=notriddle,Urgau,jieyouxu

`rustdoc --test`: Prevent reaching the maximum size of command-line by using files for arguments if there are too many

Fixes rust-lang#122722.

Thanks to this I discovered that rust was using ``@`` to add arguments from a file, quite convenient.

If there are too many `cfg` arguments given to `rustdoc --test`, it'll now put them into a temporary file and passing it as argument to the rustc command.

I added a test with 100_000 `cfg` arguments to ensure it'll not break again.

r? `@notrid`
ojeda added a commit to ojeda/linux that referenced this issue Apr 22, 2024
When KUnit tests are enabled, under very big kernel configurations
(e.g. `allyesconfig`), we may trigger an ICE in `rustdoc` [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`, workarounding the ICE and cleaning
up the command.

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

Cc: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Signed-off-by: Miguel Ojeda <[email protected]>
ojeda added a commit to ojeda/linux that referenced this issue Apr 22, 2024
When KUnit tests are enabled, under very big kernel configurations
(e.g. `allyesconfig`), we may trigger an ICE in `rustdoc` [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`, workarounding the ICE and cleaning
up the command.

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

Cc: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Signed-off-by: Miguel Ojeda <[email protected]>
ojeda added a commit to Rust-for-Linux/linux that referenced this issue Apr 22, 2024
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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
ojeda added a commit to Rust-for-Linux/linux that referenced this issue Apr 22, 2024
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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Kaz205 pushed a commit to Kaz205/linux that referenced this issue Apr 29, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue Apr 30, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue Apr 30, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
mj22226 pushed a commit to mj22226/linux that referenced this issue Apr 30, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue May 1, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue May 1, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue May 1, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue May 2, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue May 2, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue May 3, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
johnny-mnemonic pushed a commit to linux-ia64/linux-stable-rc that referenced this issue May 3, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Avenger-285714 pushed a commit to Avenger-285714/DeepinKernel that referenced this issue May 5, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Avenger-285714 pushed a commit to deepin-community/kernel that referenced this issue May 5, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
xzl01 pushed a commit to deepin-community/kernel that referenced this issue May 7, 2024
commit 50cfe93 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
wanghao75 pushed a commit to openeuler-mirror/kernel that referenced this issue May 8, 2024
stable inclusion
from stable-v6.6.30
commit 2eed4381ee41759f29adc7e235b91e8978f8e948
bugzilla: https://gitee.com/openeuler/kernel/issues/I9MPZ8

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2eed4381ee41759f29adc7e235b91e8978f8e948

--------------------------------

commit 50cfe93b01475ba36878b65d35d812e1bb48ac71 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: ZhangPeng <[email protected]>
sparkstar pushed a commit to sparkstar/noble-stable that referenced this issue Jun 25, 2024
BugLink: https://bugs.launchpad.net/bugs/2070337

commit 50cfe93b01475ba36878b65d35d812e1bb48ac71 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Manuel Diewald <[email protected]>
sparkstar pushed a commit to sparkstar/noble-stable that referenced this issue Jul 1, 2024
BugLink: https://bugs.launchpad.net/bugs/2070337

commit 50cfe93b01475ba36878b65d35d812e1bb48ac71 upstream.

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: [email protected]
Fixes: a66d733 ("rust: support running Rust documentation tests as KUnit ones")
Link: rust-lang/rust#122722 [1]
Link: rust-lang/rust#122840 [2]
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Manuel Diewald <[email protected]>
Signed-off-by: Stefan Bader <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
4 participants