mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

Update lock file encodings on changes This commit alters Cargo's lockfile encoding update strategy from its previous incarnation. Previously Cargo had two versions, one for new lock files and one for old lock files. Each of these versions were different and would affect how Cargo manages lock file updates. The intention was that we'd roll out defaults to new lock files first and then later to preexisting lock files. This requires two separate changes, though, and it's not necessarily clear when to start updating old lock files. Additionally when old lock files were opted in it would break builds using `--locked` if they simply updated Cargo because Cargo would would want to bring the lock file versions forward. The purpose of this change is to solve these issues. The new strategy for updating a lock file's encoding is to simply preserve what's already existing on the filesystem until we actually decide to write out a new lock file. When Cargo updates a lock file on-disk then it will, at that time, update the lock file encoding to whatever the current default is. This means that there's only one version number to keep track of (the default for encoding). Cargo will always preserve the preexisting encoding unless another change is required to the lock file.