From 237051fbffd2973a884209d0dad7aeeb37c8456d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 3 Dec 2019 10:47:32 -0800 Subject: [PATCH] Add a --offline hint. --- src/cargo/ops/lockfile.rs | 5 +++-- tests/testsuite/lockfile_compat.rs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index db05e859014..4b0aa7800d8 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -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 ); diff --git a/tests/testsuite/lockfile_compat.rs b/tests/testsuite/lockfile_compat.rs index 5ffcbe56055..9f4b28b8b4d 100644 --- a/tests/testsuite/lockfile_compat.rs +++ b/tests/testsuite/lockfile_compat.rs @@ -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();