Skip to content

rustbuild: Add a tidy check to ensure Cargo.lock updates are checked in #32901

Closed
@alexcrichton

Description

@alexcrichton

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:

  1. If the source is not a repository, bail out (e.g. this is a from-source build)
  2. Run git diff-index --quiet HEAD 'src/**/Cargo.lock'
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions