Skip to content

Commit 8e900aa

Browse files
committed
Enable building clippy in CI
1 parent 5f578df commit 8e900aa

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/bootstrap/check.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ impl Step for Miri {
358358

359359
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
360360
pub struct Clippy {
361+
stage: u32,
361362
host: Interned<String>,
362363
}
363364

@@ -372,24 +373,28 @@ impl Step for Clippy {
372373

373374
fn make_run(run: RunConfig) {
374375
run.builder.ensure(Clippy {
376+
stage: run.builder.top_stage,
375377
host: run.target,
376378
});
377379
}
378380

379381
/// Runs `cargo test` for clippy.
380382
fn run(self, builder: &Builder) {
381383
let build = builder.build;
384+
let stage = self.stage;
382385
let host = self.host;
383-
let compiler = builder.compiler(1, host);
386+
let compiler = builder.compiler(stage, host);
384387

385-
let _clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
388+
let clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
386389
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
387390
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
388391

389392
// Don't build tests dynamically, just a pain to work with
390393
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
391394
// clippy tests need to know about the stage sysroot
392395
cargo.env("SYSROOT", builder.sysroot(compiler));
396+
// clippy tests need to find the driver
397+
cargo.env("CLIPPY_DRIVER_PATH", clippy);
393398

394399
builder.add_rustc_lib_path(compiler, &mut cargo);
395400

src/bootstrap/tool.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
miri = "Broken"
2727

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

3131
# ping @nrc
3232
rls = "Testing"

0 commit comments

Comments
 (0)