From c6663426201ef9be3f51fb0b972236cefaf41bb0 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Mon, 20 Aug 2018 10:22:55 -0700 Subject: [PATCH] use RUSTC environment var in `parse_and_replace::compile` if present Cargo respects this environment variable (to specify the path to what rustc binary to use), but the Rustfix test suite did not. However, this capability is useful when developing new compiler diagnostics that one wants Rustfix to be able to handle (this being inspired by work on the endeavor that is rust-lang/rust#53013). --- tests/parse_and_replace.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/parse_and_replace.rs b/tests/parse_and_replace.rs index cc361cb..43e695d 100644 --- a/tests/parse_and_replace.rs +++ b/tests/parse_and_replace.rs @@ -13,6 +13,7 @@ extern crate difference; use std::collections::HashSet; use std::ffi::OsString; +use std::env; use std::fs; use std::path::{Path, PathBuf}; use std::process::Output; @@ -51,7 +52,7 @@ fn compile(file: &Path, mode: &str) -> Result { args.push("--edition=2018".into()); } - let res = duct::cmd("rustc", &args) + let res = duct::cmd(env::var_os("RUSTC").unwrap_or("rustc".into()), &args) .env("CLIPPY_DISABLE_DOCS_LINKS", "true") .env_remove("RUST_LOG") .stdout_capture()