Skip to content

Commit 7778906

Browse files
committed
Auto merge of #45177 - oli-obk:clippy, r=alexcrichton
Enable building clippy in CI r? @alexcrichton As discussed at Rustfest. Measured additional time is 4 minutes on my machine if no dependencies are shared with other tools. In reality most dependencies are shared (especially the slow to compile ones like serde). cc @Manishearth Does not run clippy's test suite, since a) it is nontrivial in the rustc build system b) it breaks more frequently but the breakage is negligible If clippy breaks, the procedure to follow is documented under https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#external-dependencies
2 parents 7920a7c + c6c47fa commit 7778906

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

src/bootstrap/check.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ impl Step for Miri {
364364

365365
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
366366
pub struct Clippy {
367+
stage: u32,
367368
host: Interned<String>,
368369
}
369370

@@ -378,24 +379,28 @@ impl Step for Clippy {
378379

379380
fn make_run(run: RunConfig) {
380381
run.builder.ensure(Clippy {
382+
stage: run.builder.top_stage,
381383
host: run.target,
382384
});
383385
}
384386

385387
/// Runs `cargo test` for clippy.
386388
fn run(self, builder: &Builder) {
387389
let build = builder.build;
390+
let stage = self.stage;
388391
let host = self.host;
389-
let compiler = builder.compiler(1, host);
392+
let compiler = builder.compiler(stage, host);
390393

391-
let _clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
394+
let clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
392395
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
393396
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
394397

395398
// Don't build tests dynamically, just a pain to work with
396399
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
397400
// clippy tests need to know about the stage sysroot
398401
cargo.env("SYSROOT", builder.sysroot(compiler));
402+
// clippy tests need to find the driver
403+
cargo.env("CLIPPY_DRIVER_PATH", clippy);
399404

400405
builder.add_rustc_lib_path(compiler, &mut cargo);
401406

src/bootstrap/tool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub struct Clippy {
387387

388388
impl Step for Clippy {
389389
type Output = PathBuf;
390-
const DEFAULT: bool = false;
390+
const DEFAULT: bool = true;
391391
const ONLY_HOSTS: bool = true;
392392

393393
fn should_run(run: ShouldRun) -> ShouldRun {
@@ -411,7 +411,7 @@ impl Step for Clippy {
411411
builder.ensure(ToolBuild {
412412
compiler: self.compiler,
413413
target: self.target,
414-
tool: "clippy",
414+
tool: "clippy-driver",
415415
mode: Mode::Librustc,
416416
path: "src/tools/clippy",
417417
expectation: builder.build.config.toolstate.clippy.passes(ToolState::Compiling),

src/tools/clippy

src/tools/toolstate.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# There are three states a tool can be in:
55
# 1. Broken: The tool doesn't build
6-
# 2. Building: The tool builds but its tests are failing
6+
# 2. Compiling: The tool builds but its tests are failing
77
# 3. Testing: The tool builds and its tests are passing
88
#
99
# In the future there will be further states like "Distributing", which
@@ -26,7 +26,7 @@
2626
miri = "Broken"
2727

2828
# ping @Manishearth @llogiq @mcarton @oli-obk
29-
clippy = "Broken"
29+
clippy = "Compiling"
3030

3131
# ping @nrc
3232
rls = "Testing"

0 commit comments

Comments
 (0)