diff --git a/src/bin/cargo/commands/fetch.rs b/src/bin/cargo/commands/fetch.rs
index 1c25204e3727..fff56a3a92e7 100644
--- a/src/bin/cargo/commands/fetch.rs
+++ b/src/bin/cargo/commands/fetch.rs
@@ -9,6 +9,7 @@ pub fn cli() -> Command {
.arg_silent_suggestion()
.arg_target_triple("Fetch dependencies for the target triple")
.arg_manifest_path()
+ .arg(flag("offline", "Run without accessing the network").hide(true))
.after_help(color_print::cstr!(
"Run `cargo help fetch>` for more detailed information.\n"
))
diff --git a/src/doc/man/cargo-fetch.md b/src/doc/man/cargo-fetch.md
index b8a0eb666209..3551a99c843f 100644
--- a/src/doc/man/cargo-fetch.md
+++ b/src/doc/man/cargo-fetch.md
@@ -2,6 +2,7 @@
{{~*set command="fetch"}}
{{~*set actionverb="Fetch"}}
{{~*set target-default-to-all-arch=true}}
+{{~*set no-offline-option=true}}
{{~*set multitarget=true}}
## NAME
diff --git a/src/doc/man/generated_txt/cargo-fetch.txt b/src/doc/man/generated_txt/cargo-fetch.txt
index cbd3169c3131..0f3bb2e47cf4 100644
--- a/src/doc/man/generated_txt/cargo-fetch.txt
+++ b/src/doc/man/generated_txt/cargo-fetch.txt
@@ -82,21 +82,6 @@ OPTIONS
Cargo.lock file is up-to-date (such as a CI build) or want to avoid
network access.
- --offline
- Prevents Cargo from accessing the network for any reason. Without
- this flag, Cargo will stop with an error if it needs to access the
- network and the network is not available. With this flag, Cargo will
- attempt to proceed without the network if possible.
-
- Beware that this may result in different dependency resolution than
- online mode. Cargo will restrict itself to crates that are
- downloaded locally, even if there might be a newer version as
- indicated in the local copy of the index. See the cargo-fetch(1)
- command to download dependencies before going offline.
-
- May also be specified with the net.offline config value
- .
-
Common Options
+toolchain
If Cargo has been installed with rustup, and the first argument to
diff --git a/src/doc/man/includes/options-locked.md b/src/doc/man/includes/options-locked.md
index c9ac9524e3cd..a8c47fa7cdf4 100644
--- a/src/doc/man/includes/options-locked.md
+++ b/src/doc/man/includes/options-locked.md
@@ -9,6 +9,7 @@ These may be used in environments where you want to assert that the
access.
{{/option}}
+{{#if (ne no-offline-option true)}}
{{#option "`--offline`"}}
Prevents Cargo from accessing the network for any reason. Without this
flag, Cargo will stop with an error if it needs to access the network and
@@ -23,3 +24,4 @@ offline.
May also be specified with the `net.offline` [config value](../reference/config.html).
{{/option}}
+{{/if}}
\ No newline at end of file
diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md
index aa0be675c2ca..972a0ce43c14 100644
--- a/src/doc/src/commands/cargo-fetch.md
+++ b/src/doc/src/commands/cargo-fetch.md
@@ -90,18 +90,6 @@ attempting to access the network to determine if it is out-of-date.
access.
---offline
-Prevents Cargo from accessing the network for any reason. Without this
-flag, Cargo will stop with an error if it needs to access the network and
-the network is not available. With this flag, Cargo will attempt to
-proceed without the network if possible.
-Beware that this may result in different dependency resolution than online
-mode. Cargo will restrict itself to crates that are downloaded locally, even
-if there might be a newer version as indicated in the local copy of the index.
-See the cargo-fetch(1) command to download dependencies before going
-offline.
-May also be specified with the net.offline
config value.
-
### Common Options
diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1
index 3779b9c28621..a60ce09ca232 100644
--- a/src/etc/man/cargo-fetch.1
+++ b/src/etc/man/cargo-fetch.1
@@ -95,22 +95,6 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fR file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
-.sp
-\fB\-\-offline\fR
-.RS 4
-Prevents Cargo from accessing the network for any reason. Without this
-flag, Cargo will stop with an error if it needs to access the network and
-the network is not available. With this flag, Cargo will attempt to
-proceed without the network if possible.
-.sp
-Beware that this may result in different dependency resolution than online
-mode. Cargo will restrict itself to crates that are downloaded locally, even
-if there might be a newer version as indicated in the local copy of the index.
-See the \fBcargo\-fetch\fR(1) command to download dependencies before going
-offline.
-.sp
-May also be specified with the \fBnet.offline\fR \fIconfig value\fR \&.
-.RE
.SS "Common Options"
.sp
\fB+\fR\fItoolchain\fR
diff --git a/tests/testsuite/cargo_fetch/help/stdout.log b/tests/testsuite/cargo_fetch/help/stdout.log
index 5645a6c033df..aecb3a67d44d 100644
--- a/tests/testsuite/cargo_fetch/help/stdout.log
+++ b/tests/testsuite/cargo_fetch/help/stdout.log
@@ -17,6 +17,5 @@ Manifest Options:
--manifest-path Path to Cargo.toml
--frozen Require Cargo.lock and cache are up to date
--locked Require Cargo.lock is up to date
- --offline Run without accessing the network
Run `cargo help fetch` for more detailed information.