book icon indicating copy to clipboard operation
book copied to clipboard

In most books the inportant --locked cargo flag is not mentioned.

Open StefanSalewski opened this issue 5 months ago • 0 comments

We just had a discussion in the Rust forum, see https://users.rust-lang.org/t/why-old-versions-of-crate-get-downloaded-equally-everyday/130042/16

Our current feeling is, that the Cargo.lock file is ignored, unless the --locked flag is passed to cargo install (or cargo build). I never read that before somewhere, but from the Cargo book it seems to be true:

https://doc.rust-lang.org/cargo/faq.html#why-have-cargolock-in-version-control

"cargo install will select the latest dependencies unless --locked is passed in."

We are still not sure about "cargo build", that command might use the Cargo.lock by default. But "--locked" seems to be important for "cargo install".

StefanSalewski avatar May 31 '25 18:05 StefanSalewski