Skip to content

Commit

Permalink
Auto merge of #7654 - ehuss:offline-hint, r=alexcrichton
Browse files Browse the repository at this point in the history
Add a --offline hint.

If `--locked` or `--frozen` is used, but the lock file needs to be built or updated, provide a hint for an alternate solution of using `--offline`.

Closes #7584
  • Loading branch information
bors committed Dec 3, 2019
2 parents 626f0f4 + 237051f commit 0bf7aaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cargo/ops/lockfile.rs
Expand Up @@ -56,8 +56,9 @@ pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &Resolve) -> CargoResult<
"--frozen"
};
failure::bail!(
"the lock file {} needs to be updated but {} was passed to \
prevent this",
"the lock file {} needs to be updated but {} was passed to prevent this\n\
If you want to try to generate the lock file without accessing the network, \
use the --offline flag.",
ws.root().to_path_buf().join("Cargo.lock").display(),
flag
);
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/lockfile_compat.rs
Expand Up @@ -514,6 +514,7 @@ fn locked_correct_error() {
"\
[UPDATING] `[..]` index
error: the lock file [CWD]/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, use the --offline flag.
",
)
.run();
Expand Down

0 comments on commit 0bf7aaf

Please sign in to comment.