about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-10-10 01:11:01 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-10-26 19:00:16 -0400
commit31ecd2a124ff9c466c9661862aa0a0ad2d48d1a1 (patch)
tree87f05ddfaaad8b6fb1f8a120cb41204b71e64f32 /src
parentbdbb54297ab5375f024517873a8b8a60e789b31a (diff)
Allow using clippy with either beta or nightly
Not 100% sure this will _always_ work, but it works currently.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index a2759b205d7..532949e47a1 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -866,20 +866,22 @@ impl<'a> Builder<'a> {
                 cargo.arg("-Zunstable-options");
                 // Explicitly does *not* set `--cfg=bootstrap`, since we're using a nightly clippy.
                 let host_version = Command::new("rustc").arg("--version").output().map_err(|_| ());
-                if let Err(_) = host_version.and_then(|output| {
+                let output = host_version.and_then(|output| {
                     if output.status.success()
-                        && t!(std::str::from_utf8(&output.stdout)).contains("nightly")
                     {
                         Ok(output)
                     } else {
                         Err(())
                     }
-                }) {
+                }).unwrap_or_else(|_| {
                     eprintln!(
-                        "error: `x.py clippy` requires a nightly host `rustc` toolchain with the `clippy` component"
+                        "error: `x.py clippy` requires a host `rustc` toolchain with the `clippy` component"
                     );
-                    eprintln!("help: try `rustup default nightly`");
+                    eprintln!("help: try `rustup component add clippy`");
                     std::process::exit(1);
+                });
+                if !t!(std::str::from_utf8(&output.stdout)).contains("nightly") {
+                    rustflags.arg("--cfg=bootstrap");
                 }
             } else {
                 rustflags.arg("--cfg=bootstrap");