Cargo doesn't respect version numbers of dependencies


#1

I’m pretty sure I’m using it wrong, but in my case Cargo doesn’t respect the version numbers of dependencies that I have specified. My cargo.toml specifies Rocket v0.3.4 and Cargo still uses v0.3.5 (which is the latest).

How do i stop this?

[package]
name = "My Website"
version = "0.1.0"
authors = ["Nabeel Omer <nabeelkomer@gmail.com>"]

[dependencies]
rocket = "0.3.4"
rocket_codegen = "0.3.4"
comrak = "0.2.5"
serde = "1.0.24"
serde_derive = "1.0.24"
toml = "0.4.5"
chrono = "0.4.0"
rusqlite = "0.13.0"

[[bin]]
name = "main"
path = "main.rs"

#2

Use rocket = "=0.3.4". Plain 0.3.4 allows any greater semver compatible version.


#3

Thanks.


#4

The next question is, why do you need to have 0.3.4? The reason for Cargo defaulting to this behavior is that with semver, patchlevel upgrades should be compatible. Is Rocket breaking compatibility in patch versions?


#5

There is a bug is Rocket (not exactly in Rocket, but in one of its
dependencies) that I later found out was due to nightly breakage. I was
trying to see whether it existed in other versions.


#6

That makes perfect sense then :slight_smile: