Specifying the location of the Cargo.lock file


#1

Is there a way (flag, environment variable) to force cargo to look for/generate the Cargo.lock file somewhere othern than the default location - the crate’s root? Something similar to how CARGO_TARGET_DIR specifies the location of the output directory. This would be very useful to integrate into an existing build system which expects the source tree to remain intact during a build.


#2

Don’t believe so. Even if there was, it’d be a bit weird given that, for binaries at least, Cargo.lock is part of the source tree. Having Cargo look in multiple places simultaneously also feels like a bad idea.


#3

See the --frozen and --locked flags if you want to ensure the tree is not modified during a build.


#4

It should be part of all source trees nowadays, as it allows for repeatable builds.