File tree 2 files changed +8
-3
lines changed
src/cargo/sources/registry 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -177,10 +177,14 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
177
177
fn update_index ( & mut self ) -> CargoResult < ( ) > {
178
178
if self . config . cli_unstable ( ) . offline {
179
179
if self . repo ( ) ?. is_empty ( ) ? {
180
+ // An empty repository is guaranteed to fail, since hitting
181
+ // this path means we need at least one crate. This is an
182
+ // attempt to provide a better error message other than "no
183
+ // matching package named …".
180
184
failure:: bail!(
181
185
"unable to fetch {} in offline mode\n \
182
- Run `cargo fetch` to download the registry index and all \
183
- of a project's dependencies before going offline.",
186
+ Try running without the offline flag, or try running \
187
+ `cargo fetch` within your project directory before going offline.",
184
188
self . source_id
185
189
) ;
186
190
}
Original file line number Diff line number Diff line change @@ -178,7 +178,8 @@ Caused by:
178
178
179
179
Caused by:
180
180
unable to fetch registry `https://github.com/rust-lang/crates.io-index` in offline mode
181
- Run `cargo fetch` to download the registry index and all of a project's dependencies before going offline.
181
+ Try running without the offline flag, or try running `cargo fetch` within your \
182
+ project directory before going offline.
182
183
" ,
183
184
)
184
185
. run ( ) ;
You can’t perform that action at this time.
0 commit comments