Description
Right now we don't have the majority of devs using rustbuild, so it's easy to modify Cargo.toml but forget to generate a new lock file. This in turns leads to messy diffs after the change has landed because anyone working on rustbuild will start seeing that diff.
Let's get the bots to fail the build if Cargo.toml is updated and Cargo.lock does not reflect that change. Essentially, after building all Cargo.lock files should remain unchanged. I would propose doing this by tracking the git status of Cargo.lock via these steps:
- If the source is not a repository, bail out (e.g. this is a from-source build)
- Run
git diff-index --quiet HEAD 'src/**/Cargo.lock'
- If the exit code is 0, we're good, if 1 then they're changed and error out
The make tidy
message should be a nice error message like:
dirty lock file found at src/rustc/Cargo.lock, please run:
cargo update --manifest-path src/rustc/Cargo.lock -p rustc
(or something like that)
This should be pretty easy to implement once #32590 lands (it'll just be adding a new check in our tidy
tool). Another good way to jump into rustbuild if you're interested!