Skip to content

Commit

Permalink
Apply RUSTC_WRAPPER
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 6, 2024
1 parent df7e51d commit 51f46e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ mod rustc;
use std::env;
use std::ffi::OsString;
use std::fs;
use std::iter;
use std::path::Path;
use std::process::{self, Command};

fn main() {
println!("cargo:rerun-if-changed=build/build.rs");

let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
let wrapped_rustc = rustc_wrapper.iter().chain(iter::once(&rustc));

let mut is_clippy_driver = false;
let version = loop {
let mut command = Command::new(&rustc);
let mut wrapped_rustc = wrapped_rustc.clone();
let mut command = Command::new(wrapped_rustc.next().unwrap());
command.args(wrapped_rustc);
if is_clippy_driver {
command.arg("--rustc");
}
Expand Down

0 comments on commit 51f46e2

Please sign in to comment.