Skip to content

Commit 9e2dac4

Browse files
committed
Auto merge of rust-lang#2245 - saethlin:color-always, r=RalfJung
Actually pass through the request for --color=always rust-lang/miri#2243 actually doesn't work 😂 The suggestion to split on `,` was good but `arg` is actually the whole `--json=diagnostic-rendered-ansi,artifacts,future-incompat `, and of course I didn't test that change locally and we have no test for this in CI. Therefore, I would like some guidance on making a test for this because I'm going to rely on this working.
2 parents 320084e + fed0e16 commit 9e2dac4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cargo-miri/bin.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -952,12 +952,14 @@ fn phase_runner(binary: &Path, binary_args: env::Args, phase: RunnerPhase) {
952952
assert!(suffix.starts_with('='));
953953
// Drop this argument.
954954
} else if let Some(suffix) = arg.strip_prefix(json_flag) {
955-
assert!(suffix.starts_with('='));
955+
let suffix = suffix.strip_prefix('=').unwrap();
956956
// This is how we pass through --color=always. We detect that Cargo is detecting rustc
957957
// to emit the diagnostic structure that Cargo would consume from rustc to emit colored
958958
// diagnostics, and ask rustc to emit them.
959959
// See https://github.com/rust-lang/miri/issues/2037
960-
if arg.split(',').any(|a| a == "diagnostic-rendered-ansi") {
960+
// First skip over the leading `=`, then check for diagnostic-rendered-ansi in the
961+
// comma-separated list
962+
if suffix.split(',').any(|a| a == "diagnostic-rendered-ansi") {
961963
cmd.arg("--color=always");
962964
}
963965
// But aside from remembering that colored output was requested, drop this argument.

0 commit comments

Comments
 (0)