Skip to content

Commit

Permalink
Stabilize --keep-going
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 26, 2023
1 parent b4a770b commit bc4d1d9
Show file tree
Hide file tree
Showing 37 changed files with 25 additions and 96 deletions.
7 changes: 1 addition & 6 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub trait CommandExt: Sized {
self.arg_jobs()._arg(
flag(
"keep-going",
"Do not abort the build as soon as there is an error (unstable)",
"Do not abort the build as soon as there is an error",
)
.help_heading(heading::COMPILATION_OPTIONS),
)
Expand Down Expand Up @@ -627,11 +627,6 @@ pub trait ArgMatchesExt {
}
}

if build_config.keep_going {
config
.cli_unstable()
.fail_if_stable_opt("--keep-going", 10496)?;
}
if build_config.build_plan {
config
.cli_unstable()
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-bench.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

ENVIRONMENT
See the reference
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

--future-incompat-report
Displays a future-incompat report for any future-incompatible
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

--future-incompat-report
Displays a future-incompat report for any future-incompatible
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

ENVIRONMENT
See the reference
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-fix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

ENVIRONMENT
See the reference
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

Display Options
-v, --verbose
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

Display Options
-v, --verbose
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-publish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

Display Options
-v, --verbose
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

ENVIRONMENT
See the reference
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-rustc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

--future-incompat-report
Displays a future-incompat report for any future-incompatible
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/generated_txt/cargo-rustdoc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ OPTIONS
--keep-going
Build as many crates in the dependency graph as possible, rather
than aborting the build on the first one that fails to build.
Unstable, requires -Zunstable-options.

ENVIRONMENT
See the reference
Expand Down
3 changes: 1 addition & 2 deletions src/doc/man/includes/options-keep-going.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#option "`--keep-going`"}}
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
`-Zunstable-options`.
the build on the first one that fails to build.
{{/option}}
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-bench---keep-going"><a class="option-anchor" href="#option-cargo-bench---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-build---keep-going"><a class="option-anchor" href="#option-cargo-build---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


<dt class="option-term" id="option-cargo-build---future-incompat-report"><a class="option-anchor" href="#option-cargo-build---future-incompat-report"></a><code>--future-incompat-report</code></dt>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-check---keep-going"><a class="option-anchor" href="#option-cargo-check---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


<dt class="option-term" id="option-cargo-check---future-incompat-report"><a class="option-anchor" href="#option-cargo-check---future-incompat-report"></a><code>--future-incompat-report</code></dt>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-doc---keep-going"><a class="option-anchor" href="#option-cargo-doc---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-fix---keep-going"><a class="option-anchor" href="#option-cargo-fix---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-install---keep-going"><a class="option-anchor" href="#option-cargo-install---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-package---keep-going"><a class="option-anchor" href="#option-cargo-package---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-publish---keep-going"><a class="option-anchor" href="#option-cargo-publish---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-run---keep-going"><a class="option-anchor" href="#option-cargo-run---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-rustc.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-rustc---keep-going"><a class="option-anchor" href="#option-cargo-rustc---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


<dt class="option-term" id="option-cargo-rustc---future-incompat-report"><a class="option-anchor" href="#option-cargo-rustc---future-incompat-report"></a><code>--future-incompat-report</code></dt>
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-rustdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ Should not be 0.</dd>

<dt class="option-term" id="option-cargo-rustdoc---keep-going"><a class="option-anchor" href="#option-cargo-rustdoc---keep-going"></a><code>--keep-going</code></dt>
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
<code>-Zunstable-options</code>.</dd>
the build on the first one that fails to build.</dd>


</dl>
Expand Down
31 changes: 0 additions & 31 deletions src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ For the latest nightly, see the [nightly version] of this page.
* [build-std-features](#build-std-features) --- Sets features to use with the standard library.
* [binary-dep-depinfo](#binary-dep-depinfo) --- Causes the dep-info file to track binary dependencies.
* [panic-abort-tests](#panic-abort-tests) --- Allows running tests with the "abort" panic strategy.
* [keep-going](#keep-going) --- Build as much as possible rather than aborting on the first error.
* [check-cfg](#check-cfg) --- Compile-time validation of `cfg` expressions.
* [host-config](#host-config) --- Allows setting `[target]`-like configuration settings for host build targets.
* [target-applies-to-host](#target-applies-to-host) --- Alters whether certain flags will be passed to host build targets.
Expand Down Expand Up @@ -429,36 +428,6 @@ like to stabilize it somehow!

[rust-lang/rust#64158]: https://github.com/rust-lang/rust/pull/64158

### keep-going
* Tracking Issue: [#10496](https://github.com/rust-lang/cargo/issues/10496)

`cargo build --keep-going` (and similarly for every command involving compilation, like `check` and `doc`)
will build as many crates in the dependency graph as possible,
rather than aborting the build at the first one that fails to build.

For example if the current package depends on dependencies `fails` and `works`,
one of which fails to build, `cargo check -j1` may or may not build the one that
succeeds (depending on which one of the two builds Cargo picked to run first),
whereas `cargo check -j1 --keep-going` would definitely run both builds, even if
the one run first fails.

The `-Z unstable-options` command-line option must be used in order to use
`--keep-going` while it is not yet stable:

```console
cargo check --keep-going -Z unstable-options
```

While `cargo test` and `cargo bench` commands involve compilation, they do not provide a `--keep-going` flag.
Both commands already include a similar `--no-fail-fast` flag, allowing running as many tests as possible without stopping at the first failure.
To "compile" as many tests as possible, use target selection flags like `--tests` to build test binaries separately.
For example,

```console
cargo build --tests --keep-going -Zunstable-options
cargo test --tests --no-fail-fast
```

### config-include
* Tracking Issue: [#7723](https://github.com/rust-lang/cargo/issues/7723)

Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-bench.1
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR <https://doc.rust\-lang.org/cargo/reference/environment\-variables.html> for
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-build.1
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.sp
\fB\-\-future\-incompat\-report\fR
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-check.1
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.sp
\fB\-\-future\-incompat\-report\fR
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-doc.1
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR <https://doc.rust\-lang.org/cargo/reference/environment\-variables.html> for
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-fix.1
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR <https://doc.rust\-lang.org/cargo/reference/environment\-variables.html> for
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-install.1
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SS "Display Options"
.sp
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-package.1
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SS "Display Options"
.sp
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-publish.1
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SS "Display Options"
.sp
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-run.1
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR <https://doc.rust\-lang.org/cargo/reference/environment\-variables.html> for
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-rustc.1
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.sp
\fB\-\-future\-incompat\-report\fR
Expand Down
3 changes: 1 addition & 2 deletions src/etc/man/cargo-rustdoc.1
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ Should not be 0.
\fB\-\-keep\-going\fR
.RS 4
Build as many crates in the dependency graph as possible, rather than aborting
the build on the first one that fails to build. Unstable, requires
\fB\-Zunstable\-options\fR\&.
the build on the first one that fails to build.
.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR <https://doc.rust\-lang.org/cargo/reference/environment\-variables.html> for
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,7 @@ fn check_keep_going() {
.build();

// Due to -j1, without --keep-going only one of the two bins would be built.
foo.cargo("check -j1 --keep-going -Zunstable-options")
.masquerade_as_nightly_cargo(&["keep-going"])
foo.cargo("check -j1 --keep-going")
.with_status(101)
.with_stderr_contains("error: ONE")
.with_stderr_contains("error: TWO")
Expand Down

0 comments on commit bc4d1d9

Please sign in to comment.