rust-lang / rust-lang/rust

Clippy gets rebuilt twice on every change, and rustdoc also gets rebuilt

Open
#131,636 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-contributor-roadblock C-bug T-bootstrap T-clippy
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Something seems wrong with the rebuild tracking for clippy in x.py, making working on clippy in the rustc repo (e.g. when fixing breakage from a rustc change) quite slow due to the multi-minute edit-compile cycle:

./x.py test clippy --stage 2 --bless -- local
# change something in clippy_lints
./x.py test clippy --keep-stage 0 --stage 2 --bless -- local

The last command does

Building stage0 tool lld-wrapper (x86_64-unknown-linux-gnu)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.15s
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.06s
Building compiler artifacts (stage1 -> stage2, x86_64-unknown-linux-gnu)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.28s
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
Building stage1 tool lld-wrapper (x86_64-unknown-linux-gnu)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.14s
Uplifting library (stage1 -> stage2)
Uplifting rustc (stage1 -> stage3)
Building tool clippy-driver (stage2 -> stage3, x86_64-unknown-linux-gnu)
   Compiling clippy_lints v0.1.83 (/home/r/src/rust/rustc/src/tools/clippy/clippy_lints)
   Compiling clippy v0.1.83 (/home/r/src/rust/rustc/src/tools/clippy)
    Finished `release` profile [optimized + debuginfo] target(s) in 1m 16s
Building tool rustdoc (stage1 -> stage2, x86_64-unknown-linux-gnu)
   Compiling rustdoc v0.0.0 (/home/r/src/rust/rustc/src/librustdoc)
   Compiling rustdoc-tool v0.0.0 (/home/r/src/rust/rustc/src/tools/rustdoc)
    Finished `release` profile [optimized + debuginfo] target(s) in 54.20s
Testing clippy (stage2 -> stage3, x86_64-unknown-linux-gnu)
   Compiling clippy_config v0.1.83 (/home/r/src/rust/rustc/src/tools/clippy/clippy_config)
   Compiling clippy_utils v0.1.83 (/home/r/src/rust/rustc/src/tools/clippy/clippy_utils)
   Compiling clippy_lints v0.1.83 (/home/r/src/rust/rustc/src/tools/clippy/clippy_lints)
   Compiling clippy v0.1.83 (/home/r/src/rust/rustc/src/tools/clippy)
    Finished `release` profile [optimized + debuginfo] target(s) in 1m 24s
     Running unittests src/driver.rs (build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/clippy_driver-11f2fd5bded4b22e)

That's a lot more Compiling ... lines than I would expect, and the entire thing takes so long (>4 minutes, which is longer than it takes my machine to build all of rustc!) to make iteration and testing painful.

The most surprising part is that rustdoc gets rebuilt?!? But building clippy twice also seems like something went wrong somewhere.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the x.py rebuild tracking involved in the provided clippy test command, then trace why clippy-driver is built twice and why rustdoc is rebuilt. Use the command and its build output as the reproduction case, with clippy_lints, librustdoc, and tools/rustdoc as the named components. Done means an unchanged rustc change followed by a clippy edit no longer triggers redundant builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.