Skip to content

Commit eb0ab5e

Browse files
committed
Rollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum
Added error-format flag to x.py. Fixes #48475 r? @Mark-Simulacrum
2 parents 4ab2184 + 264a921 commit eb0ab5e

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/bootstrap/bin/rustc.rs

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ fn main() {
6161
args.remove(n);
6262
}
6363

64+
if let Some(s) = env::var_os("RUSTC_ERROR_FORMAT") {
65+
args.push("--error-format".into());
66+
args.push(s);
67+
}
68+
6469
// Detect whether or not we're a build script depending on whether --target
6570
// is passed (a bit janky...)
6671
let target = args.windows(2)

src/bootstrap/builder.rs

+3
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ impl<'a> Builder<'a> {
599599
if let Some(target_linker) = self.build.linker(target) {
600600
cargo.env("RUSTC_TARGET_LINKER", target_linker);
601601
}
602+
if let Some(ref error_format) = self.config.rustc_error_format {
603+
cargo.env("RUSTC_ERROR_FORMAT", error_format);
604+
}
602605
if cmd != "build" && cmd != "check" {
603606
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
604607
}

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ pub struct Config {
5757
pub profiler: bool,
5858
pub ignore_git: bool,
5959
pub exclude: Vec<PathBuf>,
60+
pub rustc_error_format: Option<String>,
6061

6162
pub run_host_only: bool,
6263

@@ -330,6 +331,7 @@ impl Config {
330331
config.test_miri = false;
331332
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
332333

334+
config.rustc_error_format = flags.rustc_error_format;
333335
config.on_fail = flags.on_fail;
334336
config.stage = flags.stage;
335337
config.src = flags.src;

src/bootstrap/flags.rs

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub struct Flags {
4343
pub cmd: Subcommand,
4444
pub incremental: bool,
4545
pub exclude: Vec<PathBuf>,
46+
pub rustc_error_format: Option<String>,
4647
}
4748

4849
pub enum Subcommand {
@@ -118,6 +119,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
118119
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
119120
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
120121
opts.optflag("h", "help", "print this help message");
122+
opts.optflag("", "error-format", "rustc error format");
121123

122124
// fn usage()
123125
let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
@@ -370,6 +372,7 @@ Arguments:
370372
verbose: matches.opt_count("verbose"),
371373
stage,
372374
on_fail: matches.opt_str("on-fail"),
375+
rustc_error_format: matches.opt_str("error-format"),
373376
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
374377
build: matches.opt_str("build").map(|s| INTERNER.intern_string(s)),
375378
host: split(matches.opt_strs("host"))

0 commit comments

Comments
 (0)