Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tracked by #131726
RalfJung opened this issue Oct 13, 2024 · 3 comments
Open
Tracked by #131726
Labels
A-clippy Area: Clippy A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@RalfJung
Copy link
Member

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.

@RalfJung RalfJung added A-clippy Area: Clippy A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself labels Oct 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 13, 2024
@saethlin saethlin added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 15, 2024
@jieyouxu
Copy link
Member

I bet 10 bors credits this is differing RUSTFLAGS again.

@onur-ozkan
Copy link
Member

onur-ozkan commented Oct 15, 2024

Worth to solve this problem properly along with a test coverage.. I think, all rustflags should be handled from a single place and every conditional rustflags should be propagated to bootstrap shims using environment variable (something like IMPLICIT_RUSTFLAGS) so they can't invalidate the build cache. Bootstrap should never set any conditional rustflag explicitly on cargo.

@RalfJung
Copy link
Member Author

I bet 10 bors credits this is differing RUSTFLAGS again.

Having fixed some of those cases affecting Miri in the past -- that's my bet, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

5 participants