Skip to content

Commit f7ff36d

Browse files
alexcrichtonMark-Simulacrum
authored andcommitted
Update error-format to match new Cargo flags for pipelining
1 parent 6575a96 commit f7ff36d

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

src/bootstrap/bin/rustc.rs

-12
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ fn main() {
4545
}
4646
}
4747

48-
// Drop `--error-format json` because despite our desire for json messages
49-
// from Cargo we don't want any from rustc itself.
50-
if let Some(n) = args.iter().position(|n| n == "--error-format") {
51-
args.remove(n);
52-
args.remove(n);
53-
}
54-
55-
if let Some(s) = env::var_os("RUSTC_ERROR_FORMAT") {
56-
args.push("--error-format".into());
57-
args.push(s);
58-
}
59-
6048
// Detect whether or not we're a build script depending on whether --target
6149
// is passed (a bit janky...)
6250
let target = args.windows(2)

src/bootstrap/builder.rs

-3
Original file line numberDiff line numberDiff line change
@@ -980,9 +980,6 @@ impl<'a> Builder<'a> {
980980
if let Some(target_linker) = self.linker(target) {
981981
cargo.env("RUSTC_TARGET_LINKER", target_linker);
982982
}
983-
if let Some(ref error_format) = self.config.rustc_error_format {
984-
cargo.env("RUSTC_ERROR_FORMAT", error_format);
985-
}
986983
if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc {
987984
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler));
988985
}

src/bootstrap/compile.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -1116,10 +1116,6 @@ pub fn run_cargo(builder: &Builder<'_>,
11161116
},
11171117
..
11181118
} => (filenames, crate_types),
1119-
CargoMessage::CompilerMessage { message } => {
1120-
eprintln!("{}", message.rendered);
1121-
return;
1122-
}
11231119
_ => return,
11241120
};
11251121
for filename in filenames {
@@ -1256,8 +1252,12 @@ pub fn stream_cargo(
12561252
}
12571253
// Instruct Cargo to give us json messages on stdout, critically leaving
12581254
// stderr as piped so we can get those pretty colors.
1259-
cargo.arg("--message-format").arg("json")
1260-
.stdout(Stdio::piped());
1255+
let mut message_format = String::from("json-render-diagnostics");
1256+
if let Some(s) = &builder.config.rustc_error_format {
1257+
message_format.push_str(",json-diagnostic-");
1258+
message_format.push_str(s);
1259+
}
1260+
cargo.arg("--message-format").arg(message_format).stdout(Stdio::piped());
12611261

12621262
for arg in tail_args {
12631263
cargo.arg(arg);
@@ -1310,12 +1310,4 @@ pub enum CargoMessage<'a> {
13101310
BuildScriptExecuted {
13111311
package_id: Cow<'a, str>,
13121312
},
1313-
CompilerMessage {
1314-
message: ClippyMessage<'a>
1315-
}
1316-
}
1317-
1318-
#[derive(Deserialize)]
1319-
pub struct ClippyMessage<'a> {
1320-
rendered: Cow<'a, str>,
13211313
}

0 commit comments

Comments
 (0)