about summary refs log tree commit diff
path: root/src/tools/clippy
diff options
context:
space:
mode:
authorflip1995 <philipp.krones@embecosm.com>2021-01-02 18:01:42 +0100
committerflip1995 <philipp.krones@embecosm.com>2021-01-02 18:12:28 +0100
commit5dd64b3cd6280afce4786a467a24132c6e41fc8b (patch)
tree389468f983f2a952525e18e88622736b4ea32231 /src/tools/clippy
parentd35d827bc8cac2992a8cd14e3418dadb202f4693 (diff)
downloadrust-5dd64b3cd6280afce4786a467a24132c6e41fc8b.tar.gz
rust-5dd64b3cd6280afce4786a467a24132c6e41fc8b.zip
Use bootstrap rustc for versioncheck in Clippy
Diffstat (limited to 'src/tools/clippy')
-rw-r--r--src/tools/clippy/tests/versioncheck.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/clippy/tests/versioncheck.rs b/src/tools/clippy/tests/versioncheck.rs
index 589b19f68f7..76b6126c76c 100644
--- a/src/tools/clippy/tests/versioncheck.rs
+++ b/src/tools/clippy/tests/versioncheck.rs
@@ -28,10 +28,11 @@ fn check_that_clippy_has_the_same_major_version_as_rustc() {
     let clippy_minor = clippy_version.minor;
     let clippy_patch = clippy_version.patch;
 
-    // get the rustc version
-    // this way the rust-toolchain file version is honored
+    // get the rustc version either from the rustc installed with the toolchain file or from
+    // `RUSTC_REAL` if Clippy is build in the Rust repo with `./x.py`.
+    let rustc = std::env::var("RUSTC_REAL").unwrap_or_else(|_| "rustc".to_string());
     let rustc_version = String::from_utf8(
-        std::process::Command::new("rustc")
+        std::process::Command::new(&rustc)
             .arg("--version")
             .output()
             .expect("failed to run `rustc --version`")