From dc1519d0d7b818be053cdcdaa0efe3c1fd3ed8bf Mon Sep 17 00:00:00 2001
From: Ifropc
Date: Wed, 17 Jul 2024 04:56:51 -0700
Subject: [PATCH 01/12] feat: add new lockfile-path for metadata
- Also add necessary tests for the new flag
---
src/bin/cargo/commands/metadata.rs | 4 +-
src/cargo/core/workspace.rs | 12 ++
src/cargo/ops/lockfile.rs | 25 ++-
src/cargo/util/command_prelude.rs | 77 ++++++++-
tests/testsuite/lockfile_path.rs | 240 +++++++++++++++++++++++++++++
tests/testsuite/main.rs | 1 +
6 files changed, 349 insertions(+), 10 deletions(-)
create mode 100644 tests/testsuite/lockfile_path.rs
diff --git a/src/bin/cargo/commands/metadata.rs b/src/bin/cargo/commands/metadata.rs
index 83232ef47f2..0b98d50a114 100644
--- a/src/bin/cargo/commands/metadata.rs
+++ b/src/bin/cargo/commands/metadata.rs
@@ -1,6 +1,7 @@
-use crate::command_prelude::*;
use cargo::ops::{self, OutputMetadataOptions};
+use crate::command_prelude::*;
+
pub fn cli() -> Command {
subcommand("metadata")
.about(
@@ -26,6 +27,7 @@ pub fn cli() -> Command {
.arg_silent_suggestion()
.arg_features()
.arg_manifest_path()
+ .arg_lockfile_path()
.after_help(color_print::cstr!(
"Run `cargo help metadata>` for more detailed information.\n"
))
diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs
index 4ac8777bd62..f01ec890282 100644
--- a/src/cargo/core/workspace.rs
+++ b/src/cargo/core/workspace.rs
@@ -103,6 +103,9 @@ pub struct Workspace<'gctx> {
// file. This is set for `cargo install` without `--locked`.
ignore_lock: bool,
+ // Requested path of the lockfile (i.e. passed as the cli flag)
+ requested_lockfile_path: Option,
+
/// The resolver behavior specified with the `resolver` field.
resolve_behavior: ResolveBehavior,
resolve_honors_rust_version: bool,
@@ -237,6 +240,7 @@ impl<'gctx> Workspace<'gctx> {
require_optional_deps: true,
loaded_packages: RefCell::new(HashMap::new()),
ignore_lock: false,
+ requested_lockfile_path: None,
resolve_behavior: ResolveBehavior::V1,
resolve_honors_rust_version: false,
custom_metadata: None,
@@ -647,6 +651,14 @@ impl<'gctx> Workspace<'gctx> {
self
}
+ pub fn requested_lockfile_path(&self) -> Option<&PathBuf> {
+ self.requested_lockfile_path.as_ref()
+ }
+
+ pub fn set_requested_lockfile_path(&mut self, path: Option) {
+ self.requested_lockfile_path = path;
+ }
+
/// Get the lowest-common denominator `package.rust-version` within the workspace, if specified
/// anywhere
pub fn rust_version(&self) -> Option<&RustVersion> {
diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs
index 162cb6031bd..d9c4c5ee097 100644
--- a/src/cargo/ops/lockfile.rs
+++ b/src/cargo/ops/lockfile.rs
@@ -1,19 +1,20 @@
-use std::io::prelude::*;
-
use crate::core::{resolver, Resolve, ResolveVersion, Workspace};
use crate::util::errors::CargoResult;
use crate::util::Filesystem;
+use std::io::prelude::*;
use anyhow::Context as _;
+pub const LOCKFILE_NAME: &str = "Cargo.lock";
+
#[tracing::instrument(skip_all)]
pub fn load_pkg_lockfile(ws: &Workspace<'_>) -> CargoResult
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-bench.md b/src/doc/src/commands/cargo-bench.md
index d48e164e956..9e8815e7539 100644
--- a/src/doc/src/commands/cargo-bench.md
+++ b/src/doc/src/commands/cargo-bench.md
@@ -404,6 +404,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md
index d0be79bbd0f..1e2a2211057 100644
--- a/src/doc/src/commands/cargo-build.md
+++ b/src/doc/src/commands/cargo-build.md
@@ -335,6 +335,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md
index 2db53d9dcd4..7d972620452 100644
--- a/src/doc/src/commands/cargo-check.md
+++ b/src/doc/src/commands/cargo-check.md
@@ -317,6 +317,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md
index aa4e0eb46e3..9e58cbe7307 100644
--- a/src/doc/src/commands/cargo-clean.md
+++ b/src/doc/src/commands/cargo-clean.md
@@ -138,6 +138,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md
index a57389e8a2b..a05fd45c671 100644
--- a/src/doc/src/commands/cargo-doc.md
+++ b/src/doc/src/commands/cargo-doc.md
@@ -292,6 +292,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md
index 694a4a2f0ca..224db2baf08 100644
--- a/src/doc/src/commands/cargo-fetch.md
+++ b/src/doc/src/commands/cargo-fetch.md
@@ -105,6 +105,18 @@ if there might be a newer version as indicated in the local copy of the index.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md
index 6e3faa01b29..653a4acb1bc 100644
--- a/src/doc/src/commands/cargo-fix.md
+++ b/src/doc/src/commands/cargo-fix.md
@@ -397,6 +397,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-generate-lockfile.md b/src/doc/src/commands/cargo-generate-lockfile.md
index a87e86a6295..776f97ff2a4 100644
--- a/src/doc/src/commands/cargo-generate-lockfile.md
+++ b/src/doc/src/commands/cargo-generate-lockfile.md
@@ -90,6 +90,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-metadata.md b/src/doc/src/commands/cargo-metadata.md
index 3326c44a1ef..5bca0fe1c0f 100644
--- a/src/doc/src/commands/cargo-metadata.md
+++ b/src/doc/src/commands/cargo-metadata.md
@@ -458,6 +458,18 @@ offline.
--frozen
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md
index 765281f479c..ed091a12751 100644
--- a/src/doc/src/commands/cargo-package.md
+++ b/src/doc/src/commands/cargo-package.md
@@ -233,6 +233,18 @@ offline.
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
### Common Options
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md
index 0ea9255f9ce..ba9277594ae 100644
--- a/src/doc/src/commands/cargo-test.md
+++ b/src/doc/src/commands/cargo-test.md
@@ -434,6 +434,18 @@ offline.
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
Equivalent to specifying both --locked and --offline.
+
--lockfile-pathPATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with
+Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
+--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will
+either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist).
+This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
+
This option is only available on the nightly
+channel and
+requires the -Z unstable-options flag to enable (see
+#5707).
+
+
### Display Options
diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1
index ed8859da37f..20fbed027f2 100644
--- a/src/etc/man/cargo-add.1
+++ b/src/etc/man/cargo-add.1
@@ -254,6 +254,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index a9c3ba00387..ae19351f147 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -454,6 +454,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index 23e49a15e16..77ffc5a2c14 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -372,6 +372,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1
index 50dd9e37f09..2d9422ea8ac 100644
--- a/src/etc/man/cargo-check.1
+++ b/src/etc/man/cargo-check.1
@@ -353,6 +353,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1
index 00f47ad91f5..8b5a483bbb8 100644
--- a/src/etc/man/cargo-clean.1
+++ b/src/etc/man/cargo-clean.1
@@ -153,6 +153,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1
index 789a736f27b..e704976dfd9 100644
--- a/src/etc/man/cargo-doc.1
+++ b/src/etc/man/cargo-doc.1
@@ -320,6 +320,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1
index 6687506f46a..340330d586d 100644
--- a/src/etc/man/cargo-fetch.1
+++ b/src/etc/man/cargo-fetch.1
@@ -119,6 +119,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1
index 0b94291bb3e..897ea32cb17 100644
--- a/src/etc/man/cargo-fix.1
+++ b/src/etc/man/cargo-fix.1
@@ -448,6 +448,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-generate-lockfile.1 b/src/etc/man/cargo-generate-lockfile.1
index 732c805a73d..235d81871cf 100644
--- a/src/etc/man/cargo-generate-lockfile.1
+++ b/src/etc/man/cargo-generate-lockfile.1
@@ -105,6 +105,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1
index 1357ad1f5d1..bdb15057680 100644
--- a/src/etc/man/cargo-metadata.1
+++ b/src/etc/man/cargo-metadata.1
@@ -476,6 +476,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1
index 8530e5454ca..de7e71f9160 100644
--- a/src/etc/man/cargo-package.1
+++ b/src/etc/man/cargo-package.1
@@ -260,6 +260,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Miscellaneous Options"
.sp
\fB\-j\fR \fIN\fR,
diff --git a/src/etc/man/cargo-pkgid.1 b/src/etc/man/cargo-pkgid.1
index f8b7724bd58..b840275268e 100644
--- a/src/etc/man/cargo-pkgid.1
+++ b/src/etc/man/cargo-pkgid.1
@@ -159,6 +159,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1
index 8a65416f7dd..4c3ddb66550 100644
--- a/src/etc/man/cargo-publish.1
+++ b/src/etc/man/cargo-publish.1
@@ -192,6 +192,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Miscellaneous Options"
.sp
\fB\-j\fR \fIN\fR,
diff --git a/src/etc/man/cargo-remove.1 b/src/etc/man/cargo-remove.1
index 12f1dcfe808..a2fe5ee1211 100644
--- a/src/etc/man/cargo-remove.1
+++ b/src/etc/man/cargo-remove.1
@@ -119,6 +119,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Package Selection"
.sp
\fB\-p\fR \fIspec\fR\[u2026],
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index 654322fb971..dc4757ba26e 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -257,6 +257,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1
index cd07c6a32d9..f26973815e4 100644
--- a/src/etc/man/cargo-rustc.1
+++ b/src/etc/man/cargo-rustc.1
@@ -371,6 +371,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1
index f89a6f7de82..ee07bb6a7fc 100644
--- a/src/etc/man/cargo-rustdoc.1
+++ b/src/etc/man/cargo-rustdoc.1
@@ -339,6 +339,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index 84b7ef1927e..504b3b78838 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -481,6 +481,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-tree.1 b/src/etc/man/cargo-tree.1
index 9c08491c8b9..be17c79480b 100644
--- a/src/etc/man/cargo-tree.1
+++ b/src/etc/man/cargo-tree.1
@@ -304,6 +304,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Feature Selection"
The feature flags allow you to control which features are enabled. When no
feature options are given, the \fBdefault\fR feature is activated for every
diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1
index c682e05fc40..83975c2fc0b 100644
--- a/src/etc/man/cargo-update.1
+++ b/src/etc/man/cargo-update.1
@@ -181,6 +181,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/src/etc/man/cargo-vendor.1 b/src/etc/man/cargo-vendor.1
index eae728deaf7..66b842d0100 100644
--- a/src/etc/man/cargo-vendor.1
+++ b/src/etc/man/cargo-vendor.1
@@ -100,6 +100,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and
+requires the \fB\-Z unstable\-options\fR flag to enable (see
+\fI#5707\fR ).
+.RE
.SS "Display Options"
.sp
\fB\-v\fR,
diff --git a/tests/testsuite/cargo_add/help/stdout.term.svg b/tests/testsuite/cargo_add/help/stdout.term.svg
index 2e1cacd322a..e7bbb88b0e0 100644
--- a/tests/testsuite/cargo_add/help/stdout.term.svg
+++ b/tests/testsuite/cargo_add/help/stdout.term.svg
@@ -1,4 +1,4 @@
-