about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-05-29 02:33:23 +0200
committerGitHub <noreply@github.com>2020-05-29 02:33:23 +0200
commitfeaceb2063688c401a41d4d7aafc8f5735afa30a (patch)
tree44ed2e76fd0dc3de1db7754a221feaafdf5bec51
parent0204fc38d228ace4e33f63431841565ceac3b244 (diff)
parentb1063b83da7159c0dc8616fec26daeaa11b5f4d7 (diff)
downloadrust-feaceb2063688c401a41d4d7aafc8f5735afa30a.tar.gz
rust-feaceb2063688c401a41d4d7aafc8f5735afa30a.zip
Rollup merge of #72674 - Mark-Simulacrum:clippy-always-test-pass, r=oli-obk
Clippy should always build

This just unwraps clippy's build step instead of skipping tests if clippy didn't
build. This matches e.g. cargo's behavior and seems more correct, as we always
expect clippy to successfully build.

I believe this doesn't actually change anything in practice, but I feel mildly uncomfortable potentially leaving this hole open.
-rw-r--r--src/bootstrap/test.rs60
1 files changed, 26 insertions, 34 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index ed50f950fb6..f1305e2540b 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -516,45 +516,37 @@ impl Step for Clippy {
         let host = self.host;
         let compiler = builder.compiler(stage, host);
 
-        let clippy = builder.ensure(tool::Clippy {
+        let clippy = builder
+            .ensure(tool::Clippy { compiler, target: self.host, extra_features: Vec::new() })
+            .expect("in-tree tool");
+        let mut cargo = tool::prepare_tool_cargo(
+            builder,
             compiler,
-            target: self.host,
-            extra_features: Vec::new(),
-        });
-        if let Some(clippy) = clippy {
-            let mut cargo = tool::prepare_tool_cargo(
-                builder,
-                compiler,
-                Mode::ToolRustc,
-                host,
-                "test",
-                "src/tools/clippy",
-                SourceType::InTree,
-                &[],
-            );
+            Mode::ToolRustc,
+            host,
+            "test",
+            "src/tools/clippy",
+            SourceType::InTree,
+            &[],
+        );
 
-            // clippy tests need to know about the stage sysroot
-            cargo.env("SYSROOT", builder.sysroot(compiler));
-            cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
-            cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
-            let host_libs = builder.stage_out(compiler, Mode::ToolRustc).join(builder.cargo_dir());
-            let target_libs = builder
-                .stage_out(compiler, Mode::ToolRustc)
-                .join(&self.host)
-                .join(builder.cargo_dir());
-            cargo.env("HOST_LIBS", host_libs);
-            cargo.env("TARGET_LIBS", target_libs);
-            // clippy tests need to find the driver
-            cargo.env("CLIPPY_DRIVER_PATH", clippy);
+        // clippy tests need to know about the stage sysroot
+        cargo.env("SYSROOT", builder.sysroot(compiler));
+        cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
+        cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
+        let host_libs = builder.stage_out(compiler, Mode::ToolRustc).join(builder.cargo_dir());
+        let target_libs =
+            builder.stage_out(compiler, Mode::ToolRustc).join(&self.host).join(builder.cargo_dir());
+        cargo.env("HOST_LIBS", host_libs);
+        cargo.env("TARGET_LIBS", target_libs);
+        // clippy tests need to find the driver
+        cargo.env("CLIPPY_DRIVER_PATH", clippy);
 
-            cargo.arg("--").args(builder.config.cmd.test_args());
+        cargo.arg("--").args(builder.config.cmd.test_args());
 
-            builder.add_rustc_lib_path(compiler, &mut cargo);
+        builder.add_rustc_lib_path(compiler, &mut cargo);
 
-            try_run(builder, &mut cargo.into());
-        } else {
-            eprintln!("failed to test clippy: could not build");
-        }
+        try_run(builder, &mut cargo.into());
     }
 }