about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-02-25 15:54:54 +0800
committerkennytm <kennytm@gmail.com>2018-02-25 21:30:51 +0800
commiteb0ab5e6b25ce536cbb3032c31aa131a8f7caaa6 (patch)
tree1d4d58b894b232f7c70e9c22ceb5307ef41c924d
parent4ab2184312b2c6eb000b6f9f5311d26d42b32857 (diff)
parent264a92182e037c46cdcf37890e3142eaf634444d (diff)
downloadrust-eb0ab5e6b25ce536cbb3032c31aa131a8f7caaa6.tar.gz
rust-eb0ab5e6b25ce536cbb3032c31aa131a8f7caaa6.zip
Rollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum
Added error-format flag to x.py.

Fixes #48475

r? @Mark-Simulacrum
-rw-r--r--src/bootstrap/bin/rustc.rs5
-rw-r--r--src/bootstrap/builder.rs3
-rw-r--r--src/bootstrap/config.rs2
-rw-r--r--src/bootstrap/flags.rs3
4 files changed, 13 insertions, 0 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 55d104b1826..ca35a896e08 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -61,6 +61,11 @@ fn main() {
         args.remove(n);
     }
 
+    if let Some(s) = env::var_os("RUSTC_ERROR_FORMAT") {
+        args.push("--error-format".into());
+        args.push(s);
+    }
+
     // Detect whether or not we're a build script depending on whether --target
     // is passed (a bit janky...)
     let target = args.windows(2)
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index fcb78c479fa..b5946b44e05 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -599,6 +599,9 @@ impl<'a> Builder<'a> {
         if let Some(target_linker) = self.build.linker(target) {
             cargo.env("RUSTC_TARGET_LINKER", target_linker);
         }
+        if let Some(ref error_format) = self.config.rustc_error_format {
+            cargo.env("RUSTC_ERROR_FORMAT", error_format);
+        }
         if cmd != "build" && cmd != "check" {
             cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
         }
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 3cf8f36df25..6bc20181a03 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -57,6 +57,7 @@ pub struct Config {
     pub profiler: bool,
     pub ignore_git: bool,
     pub exclude: Vec<PathBuf>,
+    pub rustc_error_format: Option<String>,
 
     pub run_host_only: bool,
 
@@ -330,6 +331,7 @@ impl Config {
         config.test_miri = false;
         config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
 
+        config.rustc_error_format = flags.rustc_error_format;
         config.on_fail = flags.on_fail;
         config.stage = flags.stage;
         config.src = flags.src;
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index eb5c3b8ce14..8ca5910a11c 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -43,6 +43,7 @@ pub struct Flags {
     pub cmd: Subcommand,
     pub incremental: bool,
     pub exclude: Vec<PathBuf>,
+    pub rustc_error_format: Option<String>,
 }
 
 pub enum Subcommand {
@@ -118,6 +119,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
         opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
         opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
         opts.optflag("h", "help", "print this help message");
+        opts.optflag("", "error-format", "rustc error format");
 
         // fn usage()
         let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
@@ -370,6 +372,7 @@ Arguments:
             verbose: matches.opt_count("verbose"),
             stage,
             on_fail: matches.opt_str("on-fail"),
+            rustc_error_format: matches.opt_str("error-format"),
             keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
             build: matches.opt_str("build").map(|s| INTERNER.intern_string(s)),
             host: split(matches.opt_strs("host"))