Skip to content

"cannot specify the --color option with --json" without --color being passed #65558

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
SimonSapin opened this issue Oct 18, 2019 · 1 comment
Closed
Labels
A-driver Area: rustc_driver that ties everything together into the `rustc` compiler C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@SimonSapin
Copy link
Contributor

Running Servo’s unit tests started failing on CI a couple nightlies ago. A customized CI task to add -j1 shows:

https://tools.taskcluster.net/groups/Pl5QK7YnS3eldtQ6EwR09A/tasks/Pl5QK7YnS3eldtQ6EwR09A/runs/0/logs/public%2Flogs%2Flive.log

   Compiling servo_remutex v0.0.1 (/repo/components/remutex)
     Running `sccache rustc --edition=2018 --crate-name smoke components/remutex/tests/smoke.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C debuginfo=2 --test -C metadata=5076d3288909fc2b -C extra-filename=-5076d3288909fc2b --out-dir /repo/target/debug/deps -L dependency=/repo/target/debug/deps --extern lazy_static=/repo/target/debug/deps/liblazy_static-30d72531331b6d3e.rlib --extern log=/repo/target/debug/deps/liblog-147e2d153a2e1822.rlib --extern servo_remutex=/repo/target/debug/deps/libservo_remutex-8b018814b17ada98.rlib -C link-args=-fuse-ld=gold -W unused-extern-crates`
error: cannot specify the `--color` option with `--json`

error: could not compile `servo_remutex`.

The error message appears to come from here:

if matches.opt_str("color").is_some() {
early_error(
ErrorOutputType::default(),
"cannot specify the `--color` option with `--json`",
);
}

Reading through the call sites of this function I quickly reach env::args_os() in rustc_driver::main, so I don’t understand how this message could be emitted while --color is not actually present in the command-line arguments given to rustc by Cargo.

I have also not managed to reproduce this outside of the CI environment.

I don’t have an exact regression range, but this started happening a couple days ago which is close to when #65445 landed. This PR updated Cargo, including rust-lang/cargo#7450 whose description mentions using rustc’s JSON output more. I suspect this is what caused the issue to be uncovered, but it looks like the root cause is in rustc’s argument parsing.

@SimonSapin SimonSapin added A-driver Area: rustc_driver that ties everything together into the `rustc` compiler C-bug Category: This is a bug. labels Oct 18, 2019
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 18, 2019
@SimonSapin
Copy link
Contributor Author

Sorry for the noise! I managed to reproduce in a local docker container (in order to copy CI’s config exactly), the problem turned out to be using an old version of sccache: mozilla/sccache#488

SimonSapin added a commit to servo/servo that referenced this issue Oct 18, 2019
bors-servo pushed a commit to servo/servo that referenced this issue Oct 18, 2019
SimonSapin added a commit to servo/servo that referenced this issue Oct 21, 2019
bors-servo pushed a commit to servo/servo that referenced this issue Oct 21, 2019
SimonSapin added a commit to servo/servo that referenced this issue Oct 21, 2019
bors-servo pushed a commit to servo/servo that referenced this issue Oct 21, 2019
bors-servo pushed a commit to servo/servo that referenced this issue Oct 22, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-driver Area: rustc_driver that ties everything together into the `rustc` compiler C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants