I have a library where I defined dependency as
crypto-bigint = { version = "<= 0.7.0-rc.9", default-features = false, optional = true }
(I wanted to exclude 0.7.0-rc.10 that breaks the build)
This is being resolved to 0.7.0-rc.9 as expected.
However, when I reference this library from other project, this (now transitive) dependency resolves to 0.6.1.
Why would that be?
Thanks!
jofas
December 25, 2025, 11:36am
2
Would you mind pasting the cargo tree output from your project here?
Sure:
cargo tree
zinc-piop v0.1.0 (/home/fs/code/zinc-plus/piop)
βββ ark-std v0.5.0
β βββ num-traits v0.2.19
β β [build-dependencies]
β β βββ autocfg v1.5.0
β βββ rand v0.8.5
β βββ rand_chacha v0.3.1
β β βββ ppv-lite86 v0.2.21
β β β βββ zerocopy v0.8.31
β β β βββ zerocopy-derive v0.8.31 (proc-macro)
β β β βββ proc-macro2 v1.0.103
β β β β βββ unicode-ident v1.0.22
β β β βββ quote v1.0.42
β β β β βββ proc-macro2 v1.0.103 (*)
β β β βββ syn v2.0.111
β β β βββ proc-macro2 v1.0.103 (*)
β β β βββ quote v1.0.42 (*)
β β β βββ unicode-ident v1.0.22
β β βββ rand_core v0.6.4
β βββ rand_core v0.6.4
βββ crypto-primitives v0.1.0 (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd)
β βββ ark-ff v0.5.0
β β βββ ark-ff-asm v0.5.0 (proc-macro)
β β β βββ quote v1.0.42 (*)
β β β βββ syn v2.0.111 (*)
β β βββ ark-ff-macros v0.5.0 (proc-macro)
β β β βββ num-bigint v0.4.6
β β β β βββ num-integer v0.1.46
β β β β β βββ num-traits v0.2.19
β β β β β [build-dependencies]
β β β β β βββ autocfg v1.5.0
β β β β βββ num-traits v0.2.19 (*)
β β β βββ num-traits v0.2.19 (*)
β β β βββ proc-macro2 v1.0.103 (*)
β β β βββ quote v1.0.42 (*)
β β β βββ syn v2.0.111 (*)
β β βββ ark-serialize v0.5.0
β β β βββ ark-serialize-derive v0.5.0 (proc-macro)
β β β β βββ proc-macro2 v1.0.103 (*)
β β β β βββ quote v1.0.42 (*)
β β β β βββ syn v2.0.111 (*)
β β β βββ ark-std v0.5.0 (*)
β β β βββ arrayvec v0.7.6
β β β βββ digest v0.10.7
β β β β βββ block-buffer v0.10.4
β β β β β βββ generic-array v0.14.7
β β β β β βββ typenum v1.19.0
β β β β β [build-dependencies]
β β β β β βββ version_check v0.9.5
β β β β βββ crypto-common v0.1.7
β β β β βββ generic-array v0.14.7 (*)
β β β β βββ typenum v1.19.0
β β β βββ num-bigint v0.4.6 (*)
β β βββ ark-std v0.5.0 (*)
β β βββ arrayvec v0.7.6
β β βββ digest v0.10.7 (*)
β β βββ educe v0.6.0 (proc-macro)
β β β βββ enum-ordinalize v4.3.2
β β β β βββ enum-ordinalize-derive v4.3.2 (proc-macro)
β β β β βββ proc-macro2 v1.0.103 (*)
β β β β βββ quote v1.0.42 (*)
β β β β βββ syn v2.0.111 (*)
β β β βββ proc-macro2 v1.0.103 (*)
β β β βββ quote v1.0.42 (*)
β β β βββ syn v2.0.111 (*)
β β βββ itertools v0.13.0
β β β βββ either v1.15.0
β β βββ num-bigint v0.4.6 (*)
β β βββ num-traits v0.2.19 (*)
β β βββ paste v1.0.15 (proc-macro)
β β βββ zeroize v1.8.2
β β βββ zeroize_derive v1.4.2 (proc-macro)
β β βββ proc-macro2 v1.0.103 (*)
β β βββ quote v1.0.42 (*)
β β βββ syn v2.0.111 (*)
β βββ ark-std v0.5.0 (*)
β βββ crypto-bigint v0.6.1
β β βββ num-traits v0.2.19 (*)
β β βββ rand_core v0.6.4
β β βββ serdect v0.3.0
β β β βββ base16ct v0.2.0
β β β βββ serde v1.0.228
β β β βββ serde_core v1.0.228
β β β βββ serde_derive v1.0.228 (proc-macro)
β β β βββ proc-macro2 v1.0.103 (*)
β β β βββ quote v1.0.42 (*)
β β β βββ syn v2.0.111 (*)
β β βββ subtle v2.6.1
β βββ crypto-primitives-proc-macros v0.1.0 (proc-macro) (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd)
β β βββ proc-macro2 v1.0.103 (*)
β β βββ quote v1.0.42 (*)
β β βββ syn v2.0.111 (*)
β βββ num-traits v0.2.19 (*)
β βββ pastey v0.2.1 (proc-macro)
β βββ rand v0.9.2
β β βββ rand_chacha v0.9.0
β β β βββ ppv-lite86 v0.2.21 (*)
β β β βββ rand_core v0.9.3
β β β βββ getrandom v0.3.4
β β β βββ cfg-if v1.0.4
β β β βββ libc v0.2.178
β β βββ rand_core v0.9.3 (*)
β βββ serde v1.0.228 (*)
β βββ thiserror v2.0.17
β β βββ thiserror-impl v2.0.17 (proc-macro)
β β βββ proc-macro2 v1.0.103 (*)
β β βββ quote v1.0.42 (*)
β β βββ syn v2.0.111 (*)
β βββ zeroize v1.8.2 (*)
βββ num-traits v0.2.19 (*)
βββ thiserror v2.0.17 (*)
βββ zinc-poly v0.1.0 (/home/fs/code/zinc-plus/poly)
β βββ ark-std v0.5.0 (*)
β βββ crypto-bigint v0.7.0-rc.10
β β βββ num-traits v0.2.19 (*)
β β βββ rand_core v0.10.0-rc-3
β β βββ subtle v2.6.1
β β βββ zeroize v1.8.2 (*)
β βββ crypto-primitives v0.1.0 (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd) (*)
β βββ displaydoc v0.2.5 (proc-macro)
β β βββ proc-macro2 v1.0.103 (*)
β β βββ quote v1.0.42 (*)
β β βββ syn v2.0.111 (*)
β βββ itertools v0.14.0
β β βββ either v1.15.0
β βββ num-traits v0.2.19 (*)
β βββ rand v0.9.2 (*)
β βββ rand_core v0.9.3 (*)
β βββ thiserror v2.0.17 (*)
β βββ zinc-transcript v0.1.0 (/home/fs/code/zinc-plus/transcript)
β β βββ crypto-bigint v0.7.0-rc.10 (*)
β β βββ crypto-primitives v0.1.0 (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd) (*)
β β βββ itertools v0.14.0 (*)
β β βββ num-traits v0.2.19 (*)
β β βββ sha3 v0.10.8
β β β βββ digest v0.10.7 (*)
β β β βββ keccak v0.1.5
β β β βββ cpufeatures v0.2.17
β β β βββ libc v0.2.178
β β βββ zinc-primality v0.1.0 (/home/fs/code/zinc-plus/primality)
β β βββ crypto-bigint v0.7.0-rc.10 (*)
β β βββ crypto-primes v0.7.0-pre.3
β β β βββ crypto-bigint v0.7.0-rc.10 (*)
β β β βββ libm v0.2.15
β β β βββ rand_core v0.9.3 (*)
β β βββ crypto-primitives v0.1.0 (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd) (*)
β βββ zinc-utils v0.1.0 (/home/fs/code/zinc-plus/utils)
β βββ crypto-bigint v0.7.0-rc.10 (*)
β βββ crypto-primitives v0.1.0 (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd) (*)
β βββ num-traits v0.2.19 (*)
β βββ thiserror v2.0.17 (*)
β [dev-dependencies]
β βββ proptest v1.9.0
β βββ bit-set v0.8.0
β β βββ bit-vec v0.8.0
β βββ bit-vec v0.8.0
β βββ bitflags v2.10.0
β βββ num-traits v0.2.19 (*)
β βββ rand v0.9.2 (*)
β βββ rand_chacha v0.9.0 (*)
β βββ rand_xorshift v0.4.0
β β βββ rand_core v0.9.3 (*)
β βββ regex-syntax v0.8.8
β βββ rusty-fork v0.3.1
β β βββ fnv v1.0.7
β β βββ quick-error v1.2.3
β β βββ tempfile v3.24.0
β β β βββ fastrand v2.3.0
β β β βββ getrandom v0.3.4 (*)
β β β βββ once_cell v1.21.3
β β β βββ rustix v1.1.3
β β β βββ bitflags v2.10.0
β β β βββ linux-raw-sys v0.11.0
β β βββ wait-timeout v0.2.1
β β βββ libc v0.2.178
β βββ tempfile v3.24.0 (*)
β βββ unarray v0.1.4
β [dev-dependencies]
β βββ criterion v0.7.0
β β βββ anes v0.1.6
β β βββ cast v0.3.0
β β βββ ciborium v0.2.2
β β β βββ ciborium-io v0.2.2
β β β βββ ciborium-ll v0.2.2
β β β β βββ ciborium-io v0.2.2
β β β β βββ half v2.7.1
β β β β βββ cfg-if v1.0.4
β β β β βββ zerocopy v0.8.31 (*)
β β β βββ serde v1.0.228 (*)
β β βββ clap v4.5.53
β β β βββ clap_builder v4.5.53
β β β βββ anstyle v1.0.13
β β β βββ clap_lex v0.7.6
β β βββ criterion-plot v0.6.0
β β β βββ cast v0.3.0
β β β βββ itertools v0.13.0 (*)
β β βββ itertools v0.13.0 (*)
β β βββ num-traits v0.2.19 (*)
β β βββ oorandom v11.1.5
β β βββ plotters v0.3.7
β β β βββ num-traits v0.2.19 (*)
β β β βββ plotters-backend v0.3.7
β β β βββ plotters-svg v0.3.7
β β β βββ plotters-backend v0.3.7
β β βββ rayon v1.11.0
β β β βββ either v1.15.0
β β β βββ rayon-core v1.13.0
β β β βββ crossbeam-deque v0.8.6
β β β β βββ crossbeam-epoch v0.9.18
β β β β β βββ crossbeam-utils v0.8.21
β β β β βββ crossbeam-utils v0.8.21
β β β βββ crossbeam-utils v0.8.21
β β βββ regex v1.12.2
β β β βββ regex-automata v0.4.13
β β β β βββ regex-syntax v0.8.8
β β β βββ regex-syntax v0.8.8
β β βββ serde v1.0.228 (*)
β β βββ serde_json v1.0.147
β β β βββ itoa v1.0.16
β β β βββ memchr v2.7.6
β β β βββ serde_core v1.0.228
β β β βββ zmij v0.1.8
β β βββ tinytemplate v1.2.1
β β β βββ serde v1.0.228 (*)
β β β βββ serde_json v1.0.147 (*)
β β βββ walkdir v2.5.0
β β βββ same-file v1.0.6
β βββ proptest v1.9.0 (*)
βββ zinc-transcript v0.1.0 (/home/fs/code/zinc-plus/transcript) (*)
βββ zinc-utils v0.1.0 (/home/fs/code/zinc-plus/utils) (*)
[dev-dependencies]
βββ crypto-bigint v0.7.0-rc.10 (*)
βββ itertools v0.14.0 (*)
βββ rand v0.9.2 (*)
zinc-poly v0.1.0 (/home/fs/code/zinc-plus/poly) (*)
zinc-primality v0.1.0 (/home/fs/code/zinc-plus/primality) (*)
zinc-transcript v0.1.0 (/home/fs/code/zinc-plus/transcript) (*)
zinc-utils v0.1.0 (/home/fs/code/zinc-plus/utils) (*)
zip-plus v0.1.0 (/home/fs/code/zinc-plus/zip-plus)
βββ ark-ff v0.5.0 (*)
βββ ark-poly v0.5.0
β βββ ahash v0.8.12
β β βββ cfg-if v1.0.4
β β βββ once_cell v1.21.3
β β βββ zerocopy v0.8.31 (*)
β β [build-dependencies]
β β βββ version_check v0.9.5
β βββ ark-ff v0.5.0 (*)
β βββ ark-serialize v0.5.0 (*)
β βββ ark-std v0.5.0 (*)
β βββ educe v0.6.0 (proc-macro) (*)
β βββ hashbrown v0.15.5
β βββ allocator-api2 v0.2.21
βββ ark-std v0.5.0 (*)
βββ blake3 v1.8.2
β βββ arrayref v0.3.9
β βββ arrayvec v0.7.6
β βββ cfg-if v1.0.4
β βββ constant_time_eq v0.3.1
β [build-dependencies]
β βββ cc v1.2.50
β βββ find-msvc-tools v0.1.5
β βββ shlex v1.3.0
βββ crypto-bigint v0.7.0-rc.10 (*)
βββ crypto-primitives v0.1.0 (https://github.com/NethermindEth/crypto-primitives.git?rev=4d25cfd#4d25cfdd) (*)
βββ itertools v0.14.0 (*)
βββ num-traits v0.2.19 (*)
βββ rand v0.9.2 (*)
βββ rand_core v0.9.3 (*)
βββ thiserror v2.0.17 (*)
βββ uninit v0.6.2
βββ zinc-poly v0.1.0 (/home/fs/code/zinc-plus/poly) (*)
βββ zinc-primality v0.1.0 (/home/fs/code/zinc-plus/primality) (*)
βββ zinc-transcript v0.1.0 (/home/fs/code/zinc-plus/transcript) (*)
βββ zinc-utils v0.1.0 (/home/fs/code/zinc-plus/utils) (*)
[dev-dependencies]
βββ criterion v0.7.0 (*)
βββ proptest v1.9.0 (
This crypto-primitives is the library in question
jofas
December 25, 2025, 12:04pm
4
Interesting. Maybe try cargo cleaning your project? I've never seen a <= dependency declaration with pre-releases, but I can't imagine Cargo treating 0.6.1 to be compatible with a <= 0.7.0-rc.9 declaration.
1 Like
bjorn3
December 25, 2025, 12:22pm
5
AFAIK <= 0.7.0-rc.9 will be considered compatible with all versions up to 0.7.0-rc.9 irrespective of major or minor version. Try >= 0.7.0-rc.0, <= 0.7.0-rc.9.
3 Likes
Yeah, it does make sense that 0.6.1 is compatible with <= 0.7.0-rc.9, and I should've declared it as >= 0.7.0-rc.0, <= 0.7.0-rc.9 to begin with (since my code is not compatible with 0.6)
I'm still curious why Cargo chooses 0.6.1 for <= 0.7.0-rc.9 bound though, given that it picks 0.7.0-rc.9 when compiling the library standalone. cargo clean does not change this.
Is there a way to trace the logic of picking a certain version?
jofas
December 25, 2025, 1:13pm
7
The resolver is coarsely documented here:
and the entry point of the source code of the resolver can be found here:
//! High-level APIs for executing the resolver.
//!
//! This module provides functions for running the resolver given a workspace, including loading
//! the `Cargo.lock` file and checking if it needs updating.
//!
//! There are roughly 3 main functions:
//!
//! - [`resolve_ws`]: A simple, high-level function with no options.
//! - [`resolve_ws_with_opts`]: A medium-level function with options like
//! user-provided features. This is the most appropriate function to use in
//! most cases.
//! - [`resolve_with_previous`]: A low-level function for running the resolver,
//! providing the most power and flexibility.
//!
//! ### Data Structures
//!
//! - [`Workspace`]:
//! Usually created by [`crate::util::command_prelude::ArgMatchesExt::workspace`] which discovers the root of the
//! workspace, and loads all the workspace members as a [`Package`] object
//! - [`Package`]
This file has been truncated. show original
The resolver is a terribly complex peace of logic though. My guess as to why 0.6.1 was chosen would be because Cargo de-duplicated dependencies or because 0.7.0-rc.9 and 0.7.0-rc.10 (the latter being used by some other dependencies of yours) are unresolvable together.
1 Like
Thank you so much for this insight!