You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
0.37 with --offline requires network access for build but 0.35 did not for -Z offline.
According to cargo documentation:
"Cargo, at its heart, will not attempt to access the network unless told to do so. That is, if no crates comes from crates.io, a git repository, or some other network location, Cargo will never attempt to make a network connection."
Steps
cargo new a
add dependencies and patches to Cargo.toml, see sample below
cargo build --offline
What happens:
error: failed to load source for a dependency on `memchr`
Caused by:
Unable to update registry `https://github.com/rust-lang/crates.io-index`
Caused by:
unable to fetch registry `https://github.com/rust-lang/crates.io-index` in offline mode
Try running without the offline flag, or try running `cargo fetch` within your project directory before going offline.
Expected:
Compiling memchr v2.2.1 (...)
Compiling a v0.1.0 (...)
Finished dev [unoptimized + debuginfo] target(s) in 2.75s
Cargo.toml
[package]
name = "a"
version = "0.1.0"
authors = ["a@localhost"]
edition = "2018"
[dependencies]
memchr = "2"
[patch.crates-io]
memchr = { path = "path/to/local/copy/of/memchr/source" }
Possible Solution(s)
The change was introduced by #6871, the simplest would be to remove the repo check in update_index. (I use this as a workaround and everything seems to work fine.)
Or maybe propagate an "advanced usage" flag there, which would be set if e.g. there is a patch in Cargo.toml, and the set flag would prevent early termination. Or maybe even a "keep going" command line flag, which would instruct cargo to only bail out if there is an actual problem.
Notes
Output of cargo version:
latest test with: cargo 1.36.0 from debian cago 0.37.0-3.
The text was updated successfully, but these errors were encountered:
Problem
0.37 with --offline requires network access for build but 0.35 did not for -Z offline.
According to cargo documentation:
"Cargo, at its heart, will not attempt to access the network unless told to do so. That is, if no crates comes from crates.io, a git repository, or some other network location, Cargo will never attempt to make a network connection."
Steps
cargo new a
Cargo.toml
, see sample belowcargo build --offline
What happens:
Expected:
Cargo.toml
Possible Solution(s)
The change was introduced by #6871, the simplest would be to remove the repo check in
update_index
. (I use this as a workaround and everything seems to work fine.)Or maybe propagate an "advanced usage" flag there, which would be set if e.g. there is a patch in Cargo.toml, and the set flag would prevent early termination. Or maybe even a "keep going" command line flag, which would instruct cargo to only bail out if there is an actual problem.
Notes
Output of
cargo version
:latest test with:
cargo 1.36.0
from debian cago 0.37.0-3.The text was updated successfully, but these errors were encountered: