I see on this page Specifying Dependencies - The Cargo Book
1.2.3 := >=1.2.3, <2.0.0
1.2 := >=1.2.0, <2.0.0
1 := >=1.0.0, <2.0.0
0.2.3 := >=0.2.3, <0.3.0
0.2 := >=0.2.0, <0.3.0
0.0.3 := >=0.0.3, <0.0.4
0.0 := >=0.0.0, <0.1.0
0 := >=0.0.0, <1.0.0
But for me, it should be something like that
1.2.3 := >=1.2.3, <1.3.0
1.2 := >=1.2.0, <2.0.0
1 := >=1.0.0, <2.0.0
0.2.3 := >=0.2.3, <0.3.0
0.2 := >=0.2.0, <1.0.0
0.0.3 := >=0.0.3, <0.1.0
0.0 := >=0.0.0, <1.0.0
0 := >=0.0.0, <1.0.0
Diff
version
My understanding
The docs
1.2.3 :=
>=1.2.3, <1.3.0
>=1.2.3, <2.0.0
1.2 :=
>=1.2.0, <2.0.0
>=1.2.0, <2.0.0
1 :=
>=1.0.0, <2.0.0
>=1.0.0, <2.0.0
0.2.3 :=
>=0.2.3, <0.3.0
>=0.2.3, <0.3.0
0.2 :=
>=0.2.0, <1.0.0
>=0.2.0, <0.3.0
0.0.3 :=
>=0.0.3, <0.1.0
>=0.0.3, <0.0.4
0.0 :=
>=0.0.0, <1.0.0
>=0.0.0, <0.1.0
0 :=
>=0.0.0, <1.0.0
>=0.0.0, <1.0.0
Where is my mistake ?
kornel
February 12, 2026, 1:47am
2
Cargo's interpretation of major version is unusual. It's not the first number, but the first non-zero number.
0.0.1 is a semver-major version 1 with no minor version and no patch version.
Apart from that, the ^ operator is the implied default meaning that it upgrades minor and patch versions.
Okay but what about the first case
1.2.3 :=
# for me it should be
>=1.2.3, <1.3.0
# per doc it is
>=1.2.3, <2.0.0
cuviper
February 12, 2026, 2:11am
4
That would be a tilde requirement, ~1.2.3 := >=1.2.3, <1.3.0.
1 Like
kornel
February 12, 2026, 2:26am
5
1.2.0 giving <2.0.0 is the ^ operator.
It's the default, because minor changes are considered non-breaking when upgrading.
epage
February 12, 2026, 3:23am
7
Note that the docs discourage ~ and other operators except in specific circustances because cargo unifies compatible versions across the dependency tree and if a package has a non-semver upper bound then it is incompatible with packages that use newer versions, causing errors and frustrating users.
1 Like