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

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

Merged
merged 6 commits into from
Mar 24, 2024

Conversation

GuillaumeGomez
Copy link
Member

Fixes #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

@rustbot
Copy link
Collaborator

rustbot commented Mar 21, 2024

Failed to set assignee to notrid: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 21, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 21, 2024

Some changes occurred in run-make tests.

cc @jieyouxu

@GuillaumeGomez
Copy link
Member Author

Github auto-complete being broken is very annoying...

r? @notriddle


// If there are too many `cfg` arguments, instead of risking reaching `Command`'s limit on
// the number of arguments, we put them into a file which we then pass as `@` argument.
if rustdoc_options.cfgs.len() + rustdoc_options.check_cfgs.len() > 1_000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thing can become unreadable and have a perf impact way lower, I suggest switching at 50. It should be enough to handle most crates without the argfile while switch sooner rather than latter for bigger crate.

Suggested change
if rustdoc_options.cfgs.len() + rustdoc_options.check_cfgs.len() > 1_000
if rustdoc_options.cfgs.len() + rustdoc_options.check_cfgs.len() > 50

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, note that check-cfg options can be very long, in particular Cargo put all the features in the same argument. So it would probably be better to compute the length of all the strings instead of just the number of strings.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, some operating systems may have low limits on the number of arguments and/or total length, so it is best to be conservative.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point I think I'll simply put all arguments into a file directly and pass it to all doctests. :)

@Urgau
Copy link
Member

Urgau commented Mar 21, 2024

While this is certainly a solution for --cfg and --check-cfg, it isn't a general solution to the issue, which would be to retry the command when it fails by putting all the args into a argfile.

Cargo utilize that mechanism internaly, ProcessBuilder::retry_with_argfile

@rust-log-analyzer

This comment has been minimized.

@notriddle
Copy link
Contributor

I think this fix is too specific to a single problem. --cfg is not the only repeatable option, so it's not the only thing that would benefit. extern_strs and lib_strs, just from a cursory glance through the file, also also produced by loops, so they could also be too big.

I would prefer if the file was restructured to create a Vec of every1 CLI option, then check if it's too big, and generate an arg file if it is. That way, no matter which CLI option causes the problem, they'll all be passed by file and avoid the problem.

Footnotes

  1. If there's an option that you specifically want to pass on the CLI and know won't cause a problem, you can exempt it and add a comment explaining why, of course. The point is that there are a few options that look like they could cause this problem that aren't going through an arg file.

@GuillaumeGomez
Copy link
Member Author

I was planning to generalize the creation of a file containing all arguments instead of checking if there are too many of them. Will make things simpler.

One thing I wonder though is how I will be able to test it...

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Mar 22, 2024

I moved more arguments into the arg file and even better: it allows to prevent recomputing some arguments for each doctest by passing the same arg file to all doctests (since it's arguments they all share), which will likely improve doctest performance nicely.

I took the opportunity to also stop cloning RustdocOptions completely and instead only clone what I need and move it into a new RustdocTestOptions type.

Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. I would still like to see a rmake.rs test1 with at least 50000 different cfgs, it won't be perfect but it should at least validate RfL usage.

Footnotes

  1. if our still encountering issue with tmp dir not being writtable, I suggest using the $(TMPDIR) env var.

src/librustdoc/doctest.rs Outdated Show resolved Hide resolved
src/librustdoc/doctest.rs Outdated Show resolved Hide resolved
@rustbot
Copy link
Collaborator

rustbot commented Mar 23, 2024

The run-make-support library was changed

cc @jieyouxu

@GuillaumeGomez
Copy link
Member Author

Implemented all suggestions and added back the run-make test using rmake.rs this time. Hopefully it'll work in the CI this time. :)

@notriddle
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 23, 2024

📌 Commit 08af772 has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2024
Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

raced with @notriddle 😄

tests/run-make/rustdoc-test-args/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/rustdoc-test-args/rmake.rs Outdated Show resolved Hide resolved
@ojeda
Copy link
Contributor

ojeda commented Mar 23, 2024

with at least 50000 different cfgs, it won't be perfect but it should at least validate RfL usage.

I am not sure it does, e.g. with very small --cfg flags like the one in the test now (A), 50000 or even 75000 do not hit the limit for me with my reproducer. I would suggest something substantially bigger.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request 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`
@RalfJung
Copy link
Member

RalfJung commented Mar 24, 2024

I think this is causing issues in Miri... rust-lang/miri#3404

@GuillaumeGomez
Copy link
Member Author

Please open an issue and tag me on it. I'll try to take a look in the week (rust nation conf so maybe not very fast...).

RenjiSann pushed a commit to RenjiSann/rust that referenced this pull request 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`
RenjiSann pushed a commit to RenjiSann/rust that referenced this pull request Mar 25, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#121281 (regression test for rust-lang#103626)
 - rust-lang#122168 (Fix validation on substituted callee bodies in MIR inliner)
 - rust-lang#122217 (Handle str literals written with `'` lexed as lifetime)
 - rust-lang#122379 (transmute: caution against int2ptr transmutation)
 - rust-lang#122840 (`rustdoc --test`: Prevent reaching the maximum size of command-line by using files for arguments if there are too many)
 - rust-lang#122907 (Uniquify `ReError` on input mode in canonicalizer)
 - rust-lang#122942 (Add test in higher ranked subtype)
 - rust-lang#122943 (add a couple more ice tests)
 - rust-lang#122963 (core/panicking: fix outdated comment)

r? `@ghost`
`@rustbot` modify labels: rollup
ojeda added a commit to ojeda/linux that referenced this pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: rustdoc's --test option may call rustc with too many arguments
9 participants