From 4e45f58852313e3dde5f617e2c26bbda5e9437c1 Mon Sep 17 00:00:00 2001
From: David Tolnay
Date: Fri, 11 Feb 2022 22:22:38 -0800
Subject: [PATCH] Unstable --keep-going flag
---
src/bin/cargo/commands/package.rs | 1 +
src/bin/cargo/commands/publish.rs | 1 +
src/cargo/core/compiler/build_config.rs | 4 +++
src/cargo/core/compiler/job_queue.rs | 5 ++--
src/cargo/ops/cargo_compile.rs | 4 ++-
src/cargo/ops/cargo_fetch.rs | 9 ++++++-
src/cargo/ops/cargo_package.rs | 10 +++++++-
src/cargo/ops/registry.rs | 2 ++
src/cargo/util/command_prelude.rs | 21 +++++++++++++++-
src/doc/man/cargo-bench.md | 1 +
src/doc/man/cargo-build.md | 1 +
src/doc/man/cargo-check.md | 1 +
src/doc/man/cargo-doc.md | 1 +
src/doc/man/cargo-fix.md | 1 +
src/doc/man/cargo-install.md | 1 +
src/doc/man/cargo-package.md | 1 +
src/doc/man/cargo-publish.md | 1 +
src/doc/man/cargo-run.md | 1 +
src/doc/man/cargo-rustc.md | 1 +
src/doc/man/cargo-rustdoc.md | 1 +
src/doc/man/cargo-test.md | 1 +
src/doc/man/generated_txt/cargo-bench.txt | 5 ++++
src/doc/man/generated_txt/cargo-build.txt | 5 ++++
src/doc/man/generated_txt/cargo-check.txt | 5 ++++
src/doc/man/generated_txt/cargo-doc.txt | 5 ++++
src/doc/man/generated_txt/cargo-fix.txt | 5 ++++
src/doc/man/generated_txt/cargo-install.txt | 5 ++++
src/doc/man/generated_txt/cargo-package.txt | 5 ++++
src/doc/man/generated_txt/cargo-publish.txt | 5 ++++
src/doc/man/generated_txt/cargo-run.txt | 5 ++++
src/doc/man/generated_txt/cargo-rustc.txt | 5 ++++
src/doc/man/generated_txt/cargo-rustdoc.txt | 5 ++++
src/doc/man/generated_txt/cargo-test.txt | 5 ++++
src/doc/man/includes/options-keep-going.md | 5 ++++
src/doc/src/commands/cargo-bench.md | 6 +++++
src/doc/src/commands/cargo-build.md | 6 +++++
src/doc/src/commands/cargo-check.md | 6 +++++
src/doc/src/commands/cargo-doc.md | 6 +++++
src/doc/src/commands/cargo-fix.md | 6 +++++
src/doc/src/commands/cargo-install.md | 6 +++++
src/doc/src/commands/cargo-package.md | 6 +++++
src/doc/src/commands/cargo-publish.md | 6 +++++
src/doc/src/commands/cargo-run.md | 6 +++++
src/doc/src/commands/cargo-rustc.md | 6 +++++
src/doc/src/commands/cargo-rustdoc.md | 6 +++++
src/doc/src/commands/cargo-test.md | 6 +++++
src/doc/src/reference/unstable.md | 23 ++++++++++++++++-
src/etc/_cargo | 1 +
src/etc/cargo.bashcomp.sh | 28 ++++++++++-----------
src/etc/man/cargo-bench.1 | 7 ++++++
src/etc/man/cargo-build.1 | 7 ++++++
src/etc/man/cargo-check.1 | 7 ++++++
src/etc/man/cargo-doc.1 | 7 ++++++
src/etc/man/cargo-fix.1 | 7 ++++++
src/etc/man/cargo-install.1 | 7 ++++++
src/etc/man/cargo-package.1 | 7 ++++++
src/etc/man/cargo-publish.1 | 7 ++++++
src/etc/man/cargo-run.1 | 7 ++++++
src/etc/man/cargo-rustc.1 | 7 ++++++
src/etc/man/cargo-rustdoc.1 | 7 ++++++
src/etc/man/cargo-test.1 | 7 ++++++
tests/testsuite/check.rs | 16 ++++++++++++
62 files changed, 337 insertions(+), 21 deletions(-)
create mode 100644 src/doc/man/includes/options-keep-going.md
diff --git a/src/bin/cargo/commands/package.rs b/src/bin/cargo/commands/package.rs
index 5584052e909..1209edc8f2e 100644
--- a/src/bin/cargo/commands/package.rs
+++ b/src/bin/cargo/commands/package.rs
@@ -53,6 +53,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
to_package: specs,
targets: args.targets(),
jobs: args.jobs()?,
+ keep_going: args.keep_going(),
cli_features: args.cli_features()?,
},
)?;
diff --git a/src/bin/cargo/commands/publish.rs b/src/bin/cargo/commands/publish.rs
index f1cdcc2c19d..8db737504d1 100644
--- a/src/bin/cargo/commands/publish.rs
+++ b/src/bin/cargo/commands/publish.rs
@@ -45,6 +45,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
to_publish: args.packages_from_flags()?,
targets: args.targets(),
jobs: args.jobs()?,
+ keep_going: args.keep_going(),
dry_run: args.is_present("dry-run"),
registry,
cli_features: args.cli_features()?,
diff --git a/src/cargo/core/compiler/build_config.rs b/src/cargo/core/compiler/build_config.rs
index 31cd3e3da53..d9c555c8088 100644
--- a/src/cargo/core/compiler/build_config.rs
+++ b/src/cargo/core/compiler/build_config.rs
@@ -15,6 +15,8 @@ pub struct BuildConfig {
pub requested_kinds: Vec,
/// Number of rustc jobs to run in parallel.
pub jobs: u32,
+ /// Do not abort the build as soon as there is an error.
+ pub keep_going: bool,
/// Build profile
pub requested_profile: InternedString,
/// The mode we are compiling in.
@@ -56,6 +58,7 @@ impl BuildConfig {
pub fn new(
config: &Config,
jobs: Option,
+ keep_going: bool,
requested_targets: &[String],
mode: CompileMode,
) -> CargoResult {
@@ -84,6 +87,7 @@ impl BuildConfig {
Ok(BuildConfig {
requested_kinds,
jobs,
+ keep_going,
requested_profile: InternedString::new("dev"),
mode,
message_format: MessageFormat::Human,
diff --git a/src/cargo/core/compiler/job_queue.rs b/src/cargo/core/compiler/job_queue.rs
index e30431caad6..a63949b69d1 100644
--- a/src/cargo/core/compiler/job_queue.rs
+++ b/src/cargo/core/compiler/job_queue.rs
@@ -825,13 +825,14 @@ impl<'cfg> DrainState<'cfg> {
//
// After a job has finished we update our internal state if it was
// successful and otherwise wait for pending work to finish if it failed
- // and then immediately return.
+ // and then immediately return (or keep going, if requested by the build
+ // config).
let mut errors = ErrorsDuringDrain { count: 0 };
// CAUTION! Do not use `?` or break out of the loop early. Every error
// must be handled in such a way that the loop is still allowed to
// drain event messages.
loop {
- if errors.count == 0 {
+ if errors.count == 0 || cx.bcx.build_config.keep_going {
if let Err(e) = self.spawn_work_if_possible(cx, jobserver_helper, scope) {
self.handle_error(&mut cx.bcx.config.shell(), &mut errors, e);
}
diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs
index 51f104ca1fe..0d28f51696f 100644
--- a/src/cargo/ops/cargo_compile.rs
+++ b/src/cargo/ops/cargo_compile.rs
@@ -85,8 +85,10 @@ pub struct CompileOptions {
impl CompileOptions {
pub fn new(config: &Config, mode: CompileMode) -> CargoResult {
+ let jobs = None;
+ let keep_going = false;
Ok(CompileOptions {
- build_config: BuildConfig::new(config, None, &[], mode)?,
+ build_config: BuildConfig::new(config, jobs, keep_going, &[], mode)?,
cli_features: CliFeatures::new_all(false),
spec: ops::Packages::Packages(Vec::new()),
filter: CompileFilter::Default {
diff --git a/src/cargo/ops/cargo_fetch.rs b/src/cargo/ops/cargo_fetch.rs
index 1e0d855d0d1..ae43f9b6fe9 100644
--- a/src/cargo/ops/cargo_fetch.rs
+++ b/src/cargo/ops/cargo_fetch.rs
@@ -20,8 +20,15 @@ pub fn fetch<'a>(
let (packages, resolve) = ops::resolve_ws(ws)?;
let jobs = Some(1);
+ let keep_going = false;
let config = ws.config();
- let build_config = BuildConfig::new(config, jobs, &options.targets, CompileMode::Build)?;
+ let build_config = BuildConfig::new(
+ config,
+ jobs,
+ keep_going,
+ &options.targets,
+ CompileMode::Build,
+ )?;
let data = RustcTargetData::new(ws, &build_config.requested_kinds)?;
let mut fetched_packages = HashSet::new();
let mut deps_to_fetch = ws.members().map(|p| p.package_id()).collect::>();
diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs
index ab1a6180cb3..a863e413a90 100644
--- a/src/cargo/ops/cargo_package.rs
+++ b/src/cargo/ops/cargo_package.rs
@@ -30,6 +30,7 @@ pub struct PackageOpts<'cfg> {
pub allow_dirty: bool,
pub verify: bool,
pub jobs: Option,
+ pub keep_going: bool,
pub to_package: ops::Packages,
pub targets: Vec,
pub cli_features: CliFeatures,
@@ -177,6 +178,7 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult
diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md
index 13d64329f25..dd845e13958 100644
--- a/src/doc/src/commands/cargo-check.md
+++ b/src/doc/src/commands/cargo-check.md
@@ -366,6 +366,12 @@ for more information about how toolchain overrides work.
the number of CPUs.
+
--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 warnings
produced during execution of this command
diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md
index 1495c71e757..d8380cb912b 100644
--- a/src/doc/src/commands/cargo-doc.md
+++ b/src/doc/src/commands/cargo-doc.md
@@ -340,6 +340,12 @@ for more information about how toolchain overrides work.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md
index eeeda3d5dca..04b4a54642e 100644
--- a/src/doc/src/commands/cargo-fix.md
+++ b/src/doc/src/commands/cargo-fix.md
@@ -446,6 +446,12 @@ for more information about how toolchain overrides work.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-install.md b/src/doc/src/commands/cargo-install.md
index 0fbc4a3d0a6..ab363420923 100644
--- a/src/doc/src/commands/cargo-install.md
+++ b/src/doc/src/commands/cargo-install.md
@@ -295,6 +295,12 @@ offline.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md
index 4ac9db605b2..0c592d25be8 100644
--- a/src/doc/src/commands/cargo-package.md
+++ b/src/doc/src/commands/cargo-package.md
@@ -227,6 +227,12 @@ offline.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-publish.md b/src/doc/src/commands/cargo-publish.md
index 79cf1f4a798..955d062be18 100644
--- a/src/doc/src/commands/cargo-publish.md
+++ b/src/doc/src/commands/cargo-publish.md
@@ -193,6 +193,12 @@ offline.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md
index abd9b536fce..100dedc3c0a 100644
--- a/src/doc/src/commands/cargo-run.md
+++ b/src/doc/src/commands/cargo-run.md
@@ -279,6 +279,12 @@ for more information about how toolchain overrides work.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md
index d5f98e8d94d..28a6a8e9b4e 100644
--- a/src/doc/src/commands/cargo-rustc.md
+++ b/src/doc/src/commands/cargo-rustc.md
@@ -358,6 +358,12 @@ for more information about how toolchain overrides work.
the number of CPUs.
+
--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 warnings
produced during execution of this command
diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md
index 12550053e6f..af2b05f5f98 100644
--- a/src/doc/src/commands/cargo-rustdoc.md
+++ b/src/doc/src/commands/cargo-rustdoc.md
@@ -359,6 +359,12 @@ for more information about how toolchain overrides work.
the number of CPUs.
+
--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
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md
index cc47cfd17d6..34d29ffbec5 100644
--- a/src/doc/src/commands/cargo-test.md
+++ b/src/doc/src/commands/cargo-test.md
@@ -455,6 +455,12 @@ includes an option to control the number of threads used:
the number of CPUs.
+
--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 warnings
produced during execution of this command
diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md
index 1c1db0ba713..866699266fc 100644
--- a/src/doc/src/reference/unstable.md
+++ b/src/doc/src/reference/unstable.md
@@ -80,7 +80,8 @@ Each new feature described below should explain how to use it.
* [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.
- * [crate-type](#crate-type) - Supports passing crate types to the compiler.
+ * [crate-type](#crate-type) — Supports passing crate types to the compiler.
+ * [keep-going](#keep-going) — Build as much as possible rather than aborting on the first error.
* rustdoc
* [`doctest-in-workspace`](#doctest-in-workspace) — Fixes workspace-relative paths when running doctests.
* [rustdoc-map](#rustdoc-map) — Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/).
@@ -446,6 +447,26 @@ command-line option:
cargo rustc --crate-type lib,cdylib -Z unstable-options
```
+### keep-going
+* Tracking Issue: [#0](https://github.com/rust-lang/cargo/issues/10496)
+
+`cargo build --keep-going` (and similarly for `check`, `test` etc) 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
+```
+
### config-cli
* Tracking Issue: [#7722](https://github.com/rust-lang/cargo/issues/7722)
diff --git a/src/etc/_cargo b/src/etc/_cargo
index 5356313b6d2..28f6fcab6e9 100644
--- a/src/etc/_cargo
+++ b/src/etc/_cargo
@@ -47,6 +47,7 @@ _cargo() {
parallel=(
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
+ '--keep-going[do not abort build on first error]'
)
features=(
diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh
index ae335661093..d614d778f2c 100644
--- a/src/etc/cargo.bashcomp.sh
+++ b/src/etc/cargo.bashcomp.sh
@@ -41,45 +41,45 @@ _cargo()
local opt_pkg='-p --package'
local opt_feat='--features --all-features --no-default-features'
local opt_mani='--manifest-path'
- local opt_jobs='-j --jobs'
+ local opt_parallel='-j --jobs --keep-going'
local opt_force='-f --force'
local opt_sync='-s --sync'
local opt_lock='--frozen --locked --offline'
local opt_targets="--lib --bin --bins --example --examples --test --tests --bench --benches --all-targets"
local opt___nocmd="$opt_common -V --version --list --explain"
- local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --no-run --no-fail-fast --target-dir"
- local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --release --profile --target-dir"
+ local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --no-run --no-fail-fast --target-dir"
+ local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir"
local opt__b="$opt__build"
- local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --release --profile --target-dir"
+ local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir"
local opt__c="$opt__check"
local opt__clean="$opt_common $opt_pkg $opt_mani $opt_lock --target --release --doc --target-dir --profile"
- local opt__clippy="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --release --profile --target-dir --no-deps --fix"
- local opt__doc="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs --message-format --bin --bins --lib --target --open --no-deps --release --document-private-items --target-dir --profile"
+ local opt__clippy="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --no-deps --fix"
+ local opt__doc="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel --message-format --bin --bins --lib --target --open --no-deps --release --document-private-items --target-dir --profile"
local opt__d="$opt__doc"
local opt__fetch="$opt_common $opt_mani $opt_lock --target"
- local opt__fix="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_jobs $opt_targets $opt_lock --release --target --message-format --broken-code --edition --edition-idioms --allow-no-vcs --allow-dirty --allow-staged --profile --target-dir"
+ local opt__fix="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_parallel $opt_targets $opt_lock --release --target --message-format --broken-code --edition --edition-idioms --allow-no-vcs --allow-dirty --allow-staged --profile --target-dir"
local opt__generate_lockfile="$opt_common $opt_mani $opt_lock"
local opt__help="$opt_help"
local opt__init="$opt_common $opt_lock --bin --lib --name --vcs --edition --registry"
- local opt__install="$opt_common $opt_feat $opt_jobs $opt_lock $opt_force --bin --bins --branch --debug --example --examples --git --list --path --rev --root --tag --version --registry --target --profile --no-track"
+ local opt__install="$opt_common $opt_feat $opt_parallel $opt_lock $opt_force --bin --bins --branch --debug --example --examples --git --list --path --rev --root --tag --version --registry --target --profile --no-track"
local opt__locate_project="$opt_common $opt_mani $opt_lock --message-format --workspace"
local opt__login="$opt_common $opt_lock --registry"
local opt__metadata="$opt_common $opt_feat $opt_mani $opt_lock --format-version=1 --no-deps --filter-platform"
local opt__new="$opt_common $opt_lock --vcs --bin --lib --name --edition --registry"
local opt__owner="$opt_common $opt_lock -a --add -r --remove -l --list --index --token --registry"
- local opt__package="$opt_common $opt_mani $opt_feat $opt_lock $opt_jobs --allow-dirty -l --list --no-verify --no-metadata --target --target-dir"
+ local opt__package="$opt_common $opt_mani $opt_feat $opt_lock $opt_parallel --allow-dirty -l --list --no-verify --no-metadata --target --target-dir"
local opt__pkgid="$opt_common $opt_mani $opt_lock $opt_pkg"
- local opt__publish="$opt_common $opt_mani $opt_feat $opt_lock $opt_jobs --allow-dirty --dry-run --token --no-verify --index --registry --target --target-dir"
+ local opt__publish="$opt_common $opt_mani $opt_feat $opt_lock $opt_parallel --allow-dirty --dry-run --token --no-verify --index --registry --target --target-dir"
local opt__read_manifest="$opt_help $opt_quiet $opt_verbose $opt_mani $opt_color $opt_lock --no-deps"
local opt__report="$opt_help $opt_verbose $opt_color future-incompat future-incompatibilities"
local opt__report__future_incompat="$opt_help $opt_verbose $opt_color $opt_pkg --id"
- local opt__run="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_jobs --message-format --target --bin --example --release --target-dir --profile"
+ local opt__run="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel --message-format --target --bin --example --release --target-dir --profile"
local opt__r="$opt__run"
- local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir"
- local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --release --open --target-dir --profile"
+ local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir"
+ local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --open --target-dir --profile"
local opt__search="$opt_common $opt_lock --limit --index --registry"
- local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile"
+ local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile"
local opt__t="$opt__test"
local opt__tree="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock --target -i --invert --prefix --no-dedupe --duplicates -d --charset -f --format -e --edges"
local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index 0b19113e888..80395debf44 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -455,6 +455,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index 4cd70517e2e..3197c591cac 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -384,6 +384,13 @@ Number of parallel jobs to run. May also be specified with the
the number of CPUs.
.RE
.sp
+\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\&.
+.RE
+.sp
\fB\-\-future\-incompat\-report\fR
.RS 4
Displays a future\-incompat report for any future\-incompatible warnings
diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1
index b151e9c7d04..784ac7a2529 100644
--- a/src/etc/man/cargo-check.1
+++ b/src/etc/man/cargo-check.1
@@ -374,6 +374,13 @@ Number of parallel jobs to run. May also be specified with the
the number of CPUs.
.RE
.sp
+\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\&.
+.RE
+.sp
\fB\-\-future\-incompat\-report\fR
.RS 4
Displays a future\-incompat report for any future\-incompatible warnings
diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1
index 390da2a7afe..d373f0e8fb3 100644
--- a/src/etc/man/cargo-doc.1
+++ b/src/etc/man/cargo-doc.1
@@ -340,6 +340,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1
index 6957d6708f3..8b58f14278b 100644
--- a/src/etc/man/cargo-fix.1
+++ b/src/etc/man/cargo-fix.1
@@ -468,6 +468,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-install.1 b/src/etc/man/cargo-install.1
index 800317b4a74..ea8f91edb5f 100644
--- a/src/etc/man/cargo-install.1
+++ b/src/etc/man/cargo-install.1
@@ -326,6 +326,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SS "Display Options"
.sp
\fB\-v\fR,
diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1
index 6892821d28e..5a10a3dc37c 100644
--- a/src/etc/man/cargo-package.1
+++ b/src/etc/man/cargo-package.1
@@ -234,6 +234,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SS "Display Options"
.sp
\fB\-v\fR,
diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1
index 9df93801e6d..9626ebd5875 100644
--- a/src/etc/man/cargo-publish.1
+++ b/src/etc/man/cargo-publish.1
@@ -184,6 +184,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SS "Display Options"
.sp
\fB\-v\fR,
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index 4a940619c12..33e80374cfa 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -273,6 +273,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1
index 2611b91c2ac..bb990c9e2f0 100644
--- a/src/etc/man/cargo-rustc.1
+++ b/src/etc/man/cargo-rustc.1
@@ -369,6 +369,13 @@ Number of parallel jobs to run. May also be specified with the
the number of CPUs.
.RE
.sp
+\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\&.
+.RE
+.sp
\fB\-\-future\-incompat\-report\fR
.RS 4
Displays a future\-incompat report for any future\-incompatible warnings
diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1
index 8da62131388..d22946936ed 100644
--- a/src/etc/man/cargo-rustdoc.1
+++ b/src/etc/man/cargo-rustdoc.1
@@ -359,6 +359,13 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
+.sp
+\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\&.
+.RE
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index f2c9e8a9d79..964c49a735a 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -478,6 +478,13 @@ Number of parallel jobs to run. May also be specified with the
the number of CPUs.
.RE
.sp
+\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\&.
+.RE
+.sp
\fB\-\-future\-incompat\-report\fR
.RS 4
Displays a future\-incompat report for any future\-incompatible warnings
diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs
index 7ddd65adfbe..6b9a4bf61dd 100644
--- a/tests/testsuite/check.rs
+++ b/tests/testsuite/check.rs
@@ -853,6 +853,22 @@ fn proc_macro() {
p.cargo("check -v").env("CARGO_LOG", "cargo=trace").run();
}
+#[cargo_test]
+fn check_keep_going() {
+ let foo = project()
+ .file("src/bin/one.rs", "compile_error!(\"ONE\"); fn main() {}")
+ .file("src/bin/two.rs", "compile_error!(\"TWO\"); fn main() {}")
+ .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()
+ .with_status(101)
+ .with_stderr_contains("error: ONE")
+ .with_stderr_contains("error: TWO")
+ .run();
+}
+
#[cargo_test]
fn does_not_use_empty_rustc_wrapper() {
let p = project().file("src/lib.rs", "").build();