]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum
authorkennytm <kennytm@gmail.com>
Sun, 25 Feb 2018 07:54:54 +0000 (15:54 +0800)
committerkennytm <kennytm@gmail.com>
Sun, 25 Feb 2018 13:30:51 +0000 (21:30 +0800)
Added error-format flag to x.py.

Fixes #48475

r? @Mark-Simulacrum

src/bootstrap/bin/rustc.rs
src/bootstrap/builder.rs
src/bootstrap/config.rs
src/bootstrap/flags.rs

index 55d104b182698d3901e6c3433301cdc48e8094b3..ca35a896e08c88f07583bc88fe5adc6b4673a2fc 100644 (file)
@@ -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)
index fcb78c479fa278daa5d0d3b84d9902453a21b1f2..b5946b44e05ef6316ab5881d7250f1e923548b61 100644 (file)
@@ -599,6 +599,9 @@ pub fn cargo(&self,
         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)));
         }
index 3cf8f36df25ee683d1c319a92ad2a991e02fbcb0..6bc20181a0330a5a51eef0ae83defe310cb87e39 100644 (file)
@@ -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 @@ pub fn parse(args: &[String]) -> 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;
index eb5c3b8ce147f54ac3cc265d063d15df245b1a7a..8ca5910a11c0d5c8b2f3648992dc1758ce403415 100644 (file)
@@ -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 @@ pub fn parse(args: &[String]) -> Flags {
         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 @@ pub fn parse(args: &[String]) -> Flags {
             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"))