I ran the
cargo update command to update my dependencies.
Unfortunately, an upgrade of a particular crate broke, and my program doesn't compile anymore.
How do I force the
Cargo.lock file to reflect
I looked at doing:
cargo update --manifest-path Cargo.toml
But that still reflects the broken, updated crate instead of the one in
Thanks for any advice!
I backed it out using git, but I'm wondering if there is a way to do this with
version = "1.2.3" is the same as
version = "^1.2.3" (versus specifying an exact version) and thus I suspect the contents of your
Cargo.lock don't contradict what's in your
If you want Cargo to choose the minimal versions for your dependencies, I believe that is this unstable feature. Or the non-
direct version immediately above.
Ah, I looked in the Cargo book and see I can do this by using
rev plus the hash of the commit in the repo. I’ll try that out when I’m next to my computer.
Instead of editing Cargo.lock by hand, use the
--precise arguments to
For example, if you want to lock your project to an exact version of the
smallvec crate, run:
cargo update -p smallvec --precise 1.11.2
Great, thanks, that did it.
cargo update which upgraded the crate to the broken one, and
cargo update -p <CRATE> --precise <VERSION> downgraded
Cargo.lock back to the working version.