Skip to content

Commit b2616ce

Browse files
committed
Auto merge of rust-lang#2243 - saethlin:color-always, r=oli-obk
Pass --color=always through cargo-miri Closes rust-lang/miri#2037 I just implemented the fix suggested in that issue and it seems to work without issue.
2 parents fe04faf + 6cd74ee commit b2616ce

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cargo-miri/bin.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,14 @@ fn phase_runner(binary: &Path, binary_args: env::Args, phase: RunnerPhase) {
945945
// Drop this argument.
946946
} else if let Some(suffix) = arg.strip_prefix(json_flag) {
947947
assert!(suffix.starts_with('='));
948-
// Drop this argument.
948+
// This is how we pass through --color=always. We detect that Cargo is detecting rustc
949+
// to emit the diagnostic structure that Cargo would consume from rustc to emit colored
950+
// diagnostics, and ask rustc to emit them.
951+
// See https://github.com/rust-lang/miri/issues/2037
952+
if arg.split(',').any(|a| a == "diagnostic-rendered-ansi") {
953+
cmd.arg("--color=always");
954+
}
955+
// But aside from remembering that colored output was requested, drop this argument.
949956
} else {
950957
cmd.arg(arg);
951958
}

0 commit comments

Comments
 (0)