Cargo.lock showing differences from `cargo tree`?
⚓ Rust 📅 2025-07-30 👤 surdeus 👁️ 12What sort of factors would cause cargo b functionality to diverge from what cargo tree outputs, when looking at one particular target (eg. cargo b)?
I have a small reproducible example using rustls - it seems like ring is being compiled into there when it shouldn’t be. For example, with the following Cargo.toml:
[dependencies]
rustls = { version = "0.23", default-features = false }
then cargo tree produces the following as expected:
└── rustls v0.23.31
├── once_cell v1.21.3
├── rustls-pki-types v1.12.0
│ └── zeroize v1.8.1
├── rustls-webpki v0.103.4
│ ├── rustls-pki-types v1.12.0 (*)
│ └── untrusted v0.9.0
├── subtle v2.6.1
└── zeroize v1.8.1
However the Cargo.lock after building will still include mentions of ring:
...
[[package]]
name = "rustls-webpki"
version = "0.103.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc"
dependencies = [
"ring",
"rustls-pki-types",
"untrusted",
]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
"untrusted",
"windows-sys",
]
...
Can someone help me understand what could be causing this disparity?
2 posts - 2 participants
🏷️ Rust_feed