diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs
index 763291f6deb..422bdc4663c 100644
--- a/src/bin/cargo/cli.rs
+++ b/src/bin/cargo/cli.rs
@@ -32,7 +32,6 @@ Available unstable (nightly-only) flags:
-Z avoid-dev-deps -- Avoid installing dev-dependencies if possible
-Z minimal-versions -- Install minimal dependency versions instead of maximum
-Z no-index-update -- Do not update the registry, avoids a network request for benchmarking
- -Z offline -- Offline mode that does not perform network requests
-Z unstable-options -- Allow the usage of unstable options such as --registry
-Z config-profile -- Read profiles from .cargo/config files
-Z install-upgrade -- `cargo install` will upgrade instead of failing
@@ -168,6 +167,7 @@ fn execute_subcommand(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
&args.value_of("color").map(|s| s.to_string()),
args.is_present("frozen"),
args.is_present("locked"),
+ args.is_present("offline"),
arg_target_dir,
&args
.values_of_lossy("unstable-features")
@@ -239,6 +239,7 @@ See 'cargo help ' for more information on a specific command.\n",
)
.arg(opt("frozen", "Require Cargo.lock and cache are up to date").global(true))
.arg(opt("locked", "Require Cargo.lock is up to date").global(true))
+ .arg(opt("offline", "Run without accessing the network").global(true))
.arg(
Arg::with_name("unstable-features")
.help("Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details")
diff --git a/src/cargo/core/features.rs b/src/cargo/core/features.rs
index 3d0ae9b1759..91564645a76 100644
--- a/src/cargo/core/features.rs
+++ b/src/cargo/core/features.rs
@@ -322,7 +322,6 @@ impl Features {
pub struct CliUnstable {
pub print_im_a_teapot: bool,
pub unstable_options: bool,
- pub offline: bool,
pub no_index_update: bool,
pub avoid_dev_deps: bool,
pub minimal_versions: bool,
@@ -367,7 +366,6 @@ impl CliUnstable {
match k {
"print-im-a-teapot" => self.print_im_a_teapot = parse_bool(v)?,
"unstable-options" => self.unstable_options = true,
- "offline" => self.offline = true,
"no-index-update" => self.no_index_update = true,
"avoid-dev-deps" => self.avoid_dev_deps = true,
"minimal-versions" => self.minimal_versions = true,
diff --git a/src/cargo/core/resolver/errors.rs b/src/cargo/core/resolver/errors.rs
index ef162a0ebc9..b531743d17d 100644
--- a/src/cargo/core/resolver/errors.rs
+++ b/src/cargo/core/resolver/errors.rs
@@ -299,9 +299,9 @@ pub(super) fn activation_error(
};
if let Some(config) = config {
- if config.cli_unstable().offline {
+ if config.offline() {
msg.push_str(
- "\nAs a reminder, you're using offline mode (-Z offline) \
+ "\nAs a reminder, you're using offline mode (--offline) \
which can sometimes cause surprising resolution failures, \
if this error is too confusing you may wish to retry \
without the offline flag.",
diff --git a/src/cargo/ops/cargo_generate_lockfile.rs b/src/cargo/ops/cargo_generate_lockfile.rs
index 88600ec11e8..a7331892e88 100644
--- a/src/cargo/ops/cargo_generate_lockfile.rs
+++ b/src/cargo/ops/cargo_generate_lockfile.rs
@@ -36,7 +36,7 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes
failure::bail!("you can't generate a lockfile for an empty workspace.")
}
- if opts.config.cli_unstable().offline {
+ if opts.config.offline() {
failure::bail!("you can't update in the offline mode");
}
diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs
index 71d956e9cec..2197f45ee8a 100644
--- a/src/cargo/ops/lockfile.rs
+++ b/src/cargo/ops/lockfile.rs
@@ -47,7 +47,7 @@ pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &Resolve) -> CargoResult<
}
if !ws.config().lock_update_allowed() {
- if ws.config().cli_unstable().offline {
+ if ws.config().offline() {
failure::bail!("can't update in the offline mode");
}
diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs
index 553f0581cf7..5c85597907d 100644
--- a/src/cargo/sources/git/source.rs
+++ b/src/cargo/sources/git/source.rs
@@ -158,9 +158,9 @@ impl<'cfg> Source for GitSource<'cfg> {
let git_path = self.config.assert_package_cache_locked(&git_path);
let db_path = git_path.join("db").join(&self.ident);
- if self.config.cli_unstable().offline && !db_path.exists() {
+ if self.config.offline() && !db_path.exists() {
failure::bail!(
- "can't checkout from '{}': you are in the offline mode (-Z offline)",
+ "can't checkout from '{}': you are in the offline mode (--offline)",
self.remote.url()
);
}
@@ -172,7 +172,7 @@ impl<'cfg> Source for GitSource<'cfg> {
let actual_rev = self.remote.rev_for(&db_path, &self.reference);
let should_update = actual_rev.is_err() || self.source_id.precise().is_none();
- let (db, actual_rev) = if should_update && !self.config.cli_unstable().offline {
+ let (db, actual_rev) = if should_update && !self.config.offline() {
self.config.shell().status(
"Updating",
format!("git repository `{}`", self.remote.url()),
diff --git a/src/cargo/sources/registry/index.rs b/src/cargo/sources/registry/index.rs
index bcd7e5af05c..a4614b17d76 100644
--- a/src/cargo/sources/registry/index.rs
+++ b/src/cargo/sources/registry/index.rs
@@ -363,7 +363,7 @@ impl<'cfg> RegistryIndex<'cfg> {
yanked_whitelist: &HashSet,
f: &mut dyn FnMut(Summary),
) -> CargoResult<()> {
- if self.config.cli_unstable().offline
+ if self.config.offline()
&& self.query_inner_with_online(dep, load, yanked_whitelist, f, false)? != 0
{
return Ok(());
diff --git a/src/cargo/sources/registry/remote.rs b/src/cargo/sources/registry/remote.rs
index fb26d41ff16..1abae42e909 100644
--- a/src/cargo/sources/registry/remote.rs
+++ b/src/cargo/sources/registry/remote.rs
@@ -182,7 +182,7 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
}
fn update_index(&mut self) -> CargoResult<()> {
- if self.config.cli_unstable().offline {
+ if self.config.offline() {
if self.repo()?.is_empty()? {
// An empty repository is guaranteed to fail, since hitting
// this path means we need at least one crate. This is an
diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs
index c3935d7281e..a303da3a402 100644
--- a/src/cargo/util/config.rs
+++ b/src/cargo/util/config.rs
@@ -52,10 +52,15 @@ pub struct Config {
rustdoc: LazyCell,
/// Whether we are printing extra verbose messages
extra_verbose: bool,
- /// `frozen` is set if we shouldn't access the network
+ /// `frozen` is the same as `locked`, but additionally will not access the
+ /// network to determine if the lock file is out-of-date.
frozen: bool,
- /// `locked` is set if we should not update lock files
+ /// `locked` is set if we should not update lock files. If the lock file
+ /// is missing, or needs to be updated, an error is produced.
locked: bool,
+ /// `offline` is set if we should never access the network, but otherwise
+ /// continue operating if possible.
+ offline: bool,
/// A global static IPC control mechanism (used for managing parallel builds)
jobserver: Option,
/// Cli flags of the form "-Z something"
@@ -119,6 +124,7 @@ impl Config {
extra_verbose: false,
frozen: false,
locked: false,
+ offline: false,
jobserver: unsafe {
if GLOBAL_JOBSERVER.is_null() {
None
@@ -560,6 +566,7 @@ impl Config {
color: &Option,
frozen: bool,
locked: bool,
+ offline: bool,
target_dir: &Option,
unstable_flags: &[String],
) -> CargoResult<()> {
@@ -604,6 +611,11 @@ impl Config {
self.extra_verbose = extra_verbose;
self.frozen = frozen;
self.locked = locked;
+ self.offline = offline
+ || self
+ .get::
+
--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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
If --target is not specified, then all target dependencies are fetched.
+
+
See also the cargo-prefetch
+plugin which adds a command to download popular crates. This may be useful if
+you plan to use Cargo without a network with the --offline flag.
+
@@ -113,6 +118,23 @@
Manifest Options
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
Either of these flags requires that the Cargo.lock file is
+up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
+exit with an error. The --frozen flag also prevents Cargo from
+attempting to access the network to determine if it is out-of-date.
+
+
These may be used in environments where you want to assert that the
+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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
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.offlineconfig value.
+
+
diff --git a/src/doc/man/options-locked.adoc b/src/doc/man/options-locked.adoc
index e783f5fcd3b..45bbfa5117d 100644
--- a/src/doc/man/options-locked.adoc
+++ b/src/doc/man/options-locked.adoc
@@ -8,3 +8,17 @@
These may be used in environments where you want to assert that the
`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 man:cargo-fetch[1] command to download dependencies before going
+offline.
++
+May also be specified with the `net.offline` linkcargo:reference/config.html[config value].
diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md
index 49d5a6519f5..5c1866d143f 100644
--- a/src/doc/src/reference/config.md
+++ b/src/doc/src/reference/config.md
@@ -141,6 +141,7 @@ color = 'auto' # whether cargo colorizes output
[net]
retry = 2 # number of times a network call will automatically retried
git-fetch-with-cli = false # if `true` we'll use `git`-the-CLI to fetch git repos
+offline = false # do not access the network, but otherwise try to proceed if possible
# Alias cargo commands. The first 4 aliases are built in. If your
# command requires grouped whitespace use the list format.
diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md
index b78cb5c7d95..227309cd55d 100644
--- a/src/doc/src/reference/unstable.md
+++ b/src/doc/src/reference/unstable.md
@@ -30,19 +30,6 @@ cargo-features = ["publish-lockfile"]
publish-lockfile = true
```
-
-### Offline Mode
-* Original Issue: [#4686](https://github.com/rust-lang/cargo/issues/4686)
-* Tracking Issue: [#5655](https://github.com/rust-lang/cargo/issues/5655)
-
-The `-Z offline` flag prevents Cargo from attempting to access the network for
-any reason. Typically Cargo will stop with an error if it wants to access the
-network and it is not available.
-
-Beware that this may result in different dependency resolution than online
-mode. Cargo will restrict itself to crates that are available locally, even
-if there might be a newer version as indicated in the local copy of the index.
-
### no-index-update
* Original Issue: [#3479](https://github.com/rust-lang/cargo/issues/3479)
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index cd4275b99fb..629273951ba 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -2,12 +2,12 @@
.\" Title: cargo-bench
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-23
+.\" Date: 2019-05-08
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-BENCH" "1" "2018-12-23" "\ \&" "\ \&"
+.TH "CARGO\-BENCH" "1" "2019-05-08" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -401,6 +401,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index 20797f2378d..eeb3d9805c2 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -2,12 +2,12 @@
.\" Title: cargo-build
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2019-03-28
+.\" Date: 2019-05-08
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-BUILD" "1" "2019-03-28" "\ \&" "\ \&"
+.TH "CARGO\-BUILD" "1" "2019-05-08" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -324,6 +324,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1
index 9a0022b19ec..2ae71dea30b 100644
--- a/src/etc/man/cargo-check.1
+++ b/src/etc/man/cargo-check.1
@@ -2,12 +2,12 @@
.\" Title: cargo-check
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-CHECK" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-CHECK" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -310,6 +310,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1
index 60cabacbe59..1afb47c2de3 100644
--- a/src/etc/man/cargo-clean.1
+++ b/src/etc/man/cargo-clean.1
@@ -2,12 +2,12 @@
.\" Title: cargo-clean
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-CLEAN" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-CLEAN" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -158,6 +158,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1
index 0a06e9904d5..26a91320f60 100644
--- a/src/etc/man/cargo-doc.1
+++ b/src/etc/man/cargo-doc.1
@@ -2,12 +2,12 @@
.\" Title: cargo-doc
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-DOC" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-DOC" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -267,6 +267,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1
index 86b5f1a2f94..1fb8c1c1797 100644
--- a/src/etc/man/cargo-fetch.1
+++ b/src/etc/man/cargo-fetch.1
@@ -2,12 +2,12 @@
.\" Title: cargo-fetch
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-05-12
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-FETCH" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-FETCH" "1" "2019-05-12" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -43,6 +43,11 @@ If the lock file is not available, then this command will generate the lock
file before fetching the dependencies.
.sp
If \fB\-\-target\fP is not specified, then all target dependencies are fetched.
+.sp
+See also the \c
+.URL "https://crates.io/crates/cargo\-prefetch" "cargo\-prefetch"
+plugin which adds a command to download popular crates. This may be useful if
+you plan to use Cargo without a network with the \fB\-\-offline\fP flag.
.SH "OPTIONS"
.SS "Fetch options"
.sp
@@ -131,6 +136,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1
index 61c5da79575..25ac7e7e773 100644
--- a/src/etc/man/cargo-fix.1
+++ b/src/etc/man/cargo-fix.1
@@ -2,12 +2,12 @@
.\" Title: cargo-fix
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-FIX" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-FIX" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -380,6 +380,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-generate-lockfile.1 b/src/etc/man/cargo-generate-lockfile.1
index 5251c3f8d26..107b8c45e76 100644
--- a/src/etc/man/cargo-generate-lockfile.1
+++ b/src/etc/man/cargo-generate-lockfile.1
@@ -2,12 +2,12 @@
.\" Title: cargo-generate-lockfile
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-GENERATE\-LOCKFILE" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-GENERATE\-LOCKFILE" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -116,6 +116,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-install.1 b/src/etc/man/cargo-install.1
index 694d288776a..0419a5a7a28 100644
--- a/src/etc/man/cargo-install.1
+++ b/src/etc/man/cargo-install.1
@@ -2,12 +2,12 @@
.\" Title: cargo-install
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2019-03-31
+.\" Date: 2019-05-12
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-INSTALL" "1" "2019-03-31" "\ \&" "\ \&"
+.TH "CARGO\-INSTALL" "1" "2019-05-12" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -235,6 +235,36 @@ This may also be specified with the \fBbuild.target\fP
.RS 4
Build with the \fBdev\fP profile instead the \fBrelease\fP profile.
.RE
+.SS "Manifest Options"
+.sp
+\fB\-\-frozen\fP, \fB\-\-locked\fP
+.RS 4
+Either of these flags requires that the \fBCargo.lock\fP file is
+up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
+exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from
+attempting to access the network to determine if it is out\-of\-date.
+.sp
+These may be used in environments where you want to assert that the
+\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
+access.
+.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Miscellaneous Options"
.sp
\fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP
diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1
index b639bc3bc04..95a46d79c70 100644
--- a/src/etc/man/cargo-metadata.1
+++ b/src/etc/man/cargo-metadata.1
@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2019-01-05
+.\" Date: 2019-05-08
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-METADATA" "1" "2019-01-05" "\ \&" "\ \&"
+.TH "CARGO\-METADATA" "1" "2019-05-08" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -376,6 +376,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-pkgid.1 b/src/etc/man/cargo-pkgid.1
index 74d39a3eadf..1b80afa3c75 100644
--- a/src/etc/man/cargo-pkgid.1
+++ b/src/etc/man/cargo-pkgid.1
@@ -2,12 +2,12 @@
.\" Title: cargo-pkgid
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-PKGID" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-PKGID" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -193,6 +193,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1
index cc24f1506fa..c457a003c4c 100644
--- a/src/etc/man/cargo-publish.1
+++ b/src/etc/man/cargo-publish.1
@@ -2,12 +2,12 @@
.\" Title: cargo-publish
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2019-02-13
+.\" Date: 2019-05-08
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-PUBLISH" "1" "2019-02-13" "\ \&" "\ \&"
+.TH "CARGO\-PUBLISH" "1" "2019-05-08" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -201,6 +201,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Miscellaneous Options"
.sp
\fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index e8c1ba7bb9f..bd5f1bfe91c 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -2,12 +2,12 @@
.\" Title: cargo-run
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2019-02-05
+.\" Date: 2019-05-08
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-RUN" "1" "2019-02-05" "\ \&" "\ \&"
+.TH "CARGO\-RUN" "1" "2019-05-08" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -229,6 +229,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1
index f137e677764..f4cdd997f52 100644
--- a/src/etc/man/cargo-rustc.1
+++ b/src/etc/man/cargo-rustc.1
@@ -2,12 +2,12 @@
.\" Title: cargo-rustc
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-RUSTC" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-RUSTC" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -299,6 +299,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1
index 9453b10d582..4e1cc3693ec 100644
--- a/src/etc/man/cargo-rustdoc.1
+++ b/src/etc/man/cargo-rustdoc.1
@@ -2,12 +2,12 @@
.\" Title: cargo-rustdoc
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-RUSTDOC" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-RUSTDOC" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -307,6 +307,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index 36722b083a7..c856952c45a 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -2,12 +2,12 @@
.\" Title: cargo-test
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-23
+.\" Date: 2019-05-08
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-TEST" "1" "2018-12-23" "\ \&" "\ \&"
+.TH "CARGO\-TEST" "1" "2019-05-08" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -443,6 +443,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1
index 1997895ae7b..835e6c31412 100644
--- a/src/etc/man/cargo-update.1
+++ b/src/etc/man/cargo-update.1
@@ -2,12 +2,12 @@
.\" Title: cargo-update
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-23
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-UPDATE" "1" "2018-12-23" "\ \&" "\ \&"
+.TH "CARGO\-UPDATE" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -146,6 +146,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/src/etc/man/cargo-verify-project.1 b/src/etc/man/cargo-verify-project.1
index 3d4089cec24..a395013406a 100644
--- a/src/etc/man/cargo-verify-project.1
+++ b/src/etc/man/cargo-verify-project.1
@@ -2,12 +2,12 @@
.\" Title: cargo-verify-project
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2018-12-20
+.\" Date: 2019-04-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-VERIFY\-PROJECT" "1" "2018-12-20" "\ \&" "\ \&"
+.TH "CARGO\-VERIFY\-PROJECT" "1" "2019-04-16" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -126,6 +126,23 @@ These may be used in environments where you want to assert that the
\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
access.
.RE
+.sp
+\fB\-\-offline\fP
+.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\fP(1) command to download dependencies before going
+offline.
+.sp
+May also be specified with the \fBnet.offline\fP \c
+.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
+.RE
.SS "Common Options"
.sp
\fB\-h\fP, \fB\-\-help\fP
diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs
index 2f4fdfd2355..22b6c357d92 100644
--- a/tests/testsuite/config.rs
+++ b/tests/testsuite/config.rs
@@ -61,6 +61,7 @@ fn new_config(env: &[(&str, &str)]) -> Config {
&None,
false,
false,
+ false,
&None,
&["advanced-env".into()],
)
diff --git a/tests/testsuite/offline.rs b/tests/testsuite/offline.rs
index 69588647348..77e16d2a2ee 100644
--- a/tests/testsuite/offline.rs
+++ b/tests/testsuite/offline.rs
@@ -3,7 +3,7 @@ use std::fs;
#[test]
fn offline_unused_target_dep() {
- // -Z offline with a target dependency that is not used and not downloaded.
+ // --offline with a target dependency that is not used and not downloaded.
Package::new("unused_dep", "1.0.0").publish();
Package::new("used_dep", "1.0.0").publish();
let p = project()
@@ -28,9 +28,7 @@ fn offline_unused_target_dep() {
.run();
p.cargo("clean").run();
// Build offline, make sure it works.
- p.cargo("build -Z offline")
- .masquerade_as_nightly_cargo()
- .run();
+ p.cargo("build --offline").run();
}
#[test]
@@ -55,11 +53,8 @@ fn offline_missing_optional() {
.run();
p.cargo("clean").run();
// Build offline, make sure it works.
- p.cargo("build -Z offline")
- .masquerade_as_nightly_cargo()
- .run();
- p.cargo("build -Z offline --features=opt_dep")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --offline").run();
+ p.cargo("build --offline --features=opt_dep")
.with_stderr(
"\
[ERROR] failed to download `opt_dep v1.0.0`
@@ -92,9 +87,7 @@ fn cargo_compile_path_with_offline() {
.file("bar/src/lib.rs", "")
.build();
- p.cargo("build -Zoffline")
- .masquerade_as_nightly_cargo()
- .run();
+ p.cargo("build --offline").run();
}
#[test]
@@ -137,8 +130,7 @@ fn cargo_compile_with_downloaded_dependency_with_offline() {
.file("src/lib.rs", "")
.build();
- p2.cargo("build -Zoffline")
- .masquerade_as_nightly_cargo()
+ p2.cargo("build --offline")
.with_stderr(
"\
[COMPILING] present_dep v1.2.3
@@ -166,8 +158,7 @@ fn cargo_compile_offline_not_try_update() {
.file("src/lib.rs", "")
.build();
- p.cargo("build -Zoffline")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --offline")
.with_status(101)
.with_stderr(
"\
@@ -183,6 +174,12 @@ project directory before going offline.
",
)
.run();
+
+ p.change_file(".cargo/config", "net.offline = true");
+ p.cargo("build")
+ .with_status(101)
+ .with_stderr_contains("[..]Unable to update registry[..]")
+ .run();
}
#[test]
@@ -242,8 +239,7 @@ fn main(){
)
.build();
- p2.cargo("run -Zoffline")
- .masquerade_as_nightly_cargo()
+ p2.cargo("run --offline")
.with_stderr(
"\
[COMPILING] present_dep v1.2.3
@@ -274,15 +270,14 @@ fn cargo_compile_forbird_git_httpsrepo_offline() {
.file("src/main.rs", "")
.build();
- p.cargo("build -Zoffline").masquerade_as_nightly_cargo().with_status(101).
- with_stderr("\
+ p.cargo("build --offline").with_status(101).with_stderr("\
error: failed to load source for a dependency on `dep1`
Caused by:
Unable to update https://github.com/some_user/dep1.git
Caused by:
- can't checkout from 'https://github.com/some_user/dep1.git': you are in the offline mode (-Z offline)").run();
+ can't checkout from 'https://github.com/some_user/dep1.git': you are in the offline mode (--offline)").run();
}
#[test]
@@ -321,8 +316,7 @@ fn compile_offline_while_transitive_dep_not_cached() {
// Restore the file contents.
fs::write(&baz_path, &baz_content).unwrap();
- p.cargo("build -Zoffline")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --offline")
.with_status(101)
.with_stderr(
"\
@@ -352,8 +346,7 @@ fn update_offline() {
)
.file("src/main.rs", "fn main() {}")
.build();
- p.cargo("update -Zoffline")
- .masquerade_as_nightly_cargo()
+ p.cargo("update --offline")
.with_status(101)
.with_stderr("error: you can't update in the offline mode[..]")
.run();
@@ -448,8 +441,7 @@ fn cargo_compile_offline_with_cached_git_dep() {
let git_root = git_project.root();
- p.cargo("build -Zoffline")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --offline")
.with_stderr(format!(
"\
[COMPILING] dep1 v0.5.0 ({}#[..])
@@ -482,9 +474,7 @@ fn cargo_compile_offline_with_cached_git_dep() {
),
);
- p.cargo("build -Zoffline")
- .masquerade_as_nightly_cargo()
- .run();
+ p.cargo("build --offline").run();
p.process(&p.bin("foo"))
.with_stdout("hello from cached git repo rev1\n")
.run();
@@ -531,8 +521,7 @@ fn offline_resolve_optional_fail() {
"#,
);
- p.cargo("build -Z offline")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --offline")
.with_status(101)
.with_stderr("\
[ERROR] failed to select a version for the requirement `dep = \"^2.0\"`
@@ -540,7 +529,7 @@ fn offline_resolve_optional_fail() {
location searched: `[..]` index (which is replacing registry `https://github.com/rust-lang/crates.io-index`)
required by package `foo v0.1.0 ([..]/foo)`
perhaps a crate was updated and forgotten to be re-vendored?
-As a reminder, you're using offline mode (-Z offline) which can sometimes cause \
+As a reminder, you're using offline mode (--offline) which can sometimes cause \
surprising resolution failures, if this error is too confusing you may wish to \
retry without the offline flag.
")
diff --git a/tests/testsuite/resolve.rs b/tests/testsuite/resolve.rs
index 440eaa6b308..3a79477659e 100644
--- a/tests/testsuite/resolve.rs
+++ b/tests/testsuite/resolve.rs
@@ -68,6 +68,7 @@ proptest! {
&None,
false,
false,
+ false,
&None,
&["minimal-versions".to_string()],
)
@@ -533,6 +534,7 @@ fn test_resolving_minimum_version_with_transitive_deps() {
&None,
false,
false,
+ false,
&None,
&["minimal-versions".to_string()],
)