-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-offlineArea: offline modeArea: offline modeA-sparse-registryArea: http sparse registriesArea: http sparse registriesC-bugCategory: bugCategory: bug
Description
Problem
When using --offline
with sparse index, and attempting to resolve something that hasn't been fetched results in the following error:
error: failed to get `regex` as a dependency of package `foo v0.1.0 (/Users/eric/Temp/foo)`
Caused by:
failed to query replaced source registry `crates-io`
Caused by:
attempting to make an HTTP request, but --offline was specified
However, with non-sparse it gives the following if the index is out-of-date:
error: no matching package named `regex` found
location searched: registry `crates-io`
required by package `foo v0.1.0 (/Users/eric/Temp/foo)`
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.
I think it would be good to consider the error message in this scenario to try to help explain why --offline
may fail.
Steps
cargo new foo
cd foo
echo 'regex = "*"' >> Cargo.toml
cargo generate-lockfile -Zsparse-registry --offline
Possible Solution(s)
I suspect this may be very tricky, because I think the sparse code path is failing while updating the config.json file, long before resolution starts.
Notes
No response
Version
cargo 1.66.0-nightly (3ff044334 2022-10-17)
release: 1.66.0-nightly
commit-hash: 3ff044334f0567ce1481c78603aeee7211b91623
commit-date: 2022-10-17
host: x86_64-apple-darwin
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.79.1 (sys:0.4.55+curl-7.83.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 12.6.0 [64-bit]
Metadata
Metadata
Assignees
Labels
A-offlineArea: offline modeArea: offline modeA-sparse-registryArea: http sparse registriesArea: http sparse registriesC-bugCategory: bugCategory: bug