Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use of RUSTFLAGS="--error-format=json" causes cargo mutants to fail #136

Closed
TomMD opened this issue Aug 8, 2023 · 2 comments
Closed

Use of RUSTFLAGS="--error-format=json" causes cargo mutants to fail #136

TomMD opened this issue Aug 8, 2023 · 2 comments

Comments

@TomMD
Copy link

TomMD commented Aug 8, 2023

$ RUSTFLAGS="--error-format=json" cargo mutants
...
error: Option 'error-format' given more than once

That error is repeated many times till termination with:

*** result: Failure

   1.281211253s ERROR cargo build failed in an unmutated tree, so no mutants were tested
@sourcefrog
Copy link
Owner

This seems to come from the fact that cargo build fails with that RUSTFLAGS set, regardless of anything in cargo-mutants:

; env RUSTFLAGS="--error-format=json" cargo build 
   Compiling unix_mode v0.1.4-pre (/home/mbp/src/unix_mode)
error: Option 'error-format' given more than once

error: could not compile `unix_mode` (lib)

I'm testing here on a very simple tree that has no build.rs, https://github.com/sourcefrog/unix_mode.

This looks a bit like rust-lang/cargo#6375 or rust-lang/cargo#11452 but I'm not sure it's exactly the same. It seems more like a cargo bug than a cargo-mutants bug.

It would be possible for cargo-mutants to parse RUSTFLAGS and strip out things that we might think won't work with cargo build, but I don't know if that really fits here. Maybe it's better to just not pass it.

I filed rust-lang/cargo#12486 and unless some new information emerges I don't think there's anything to do in cargo-mutants.

@sourcefrog
Copy link
Owner

As @ehuss commented there rust-lang/cargo#12486

If you want JSON output, the correct way to do that is cargo --message-format=json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants