You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If RUSTFLAGS sets --error-format then cargo-build fails.
Steps
; cargo init demo
Created binary (application) package
; cd demo
; env RUSTFLAGS="--error-format=json" cargo build
Compiling demo v0.1.0 (/tmp/demo)
error: Option 'error-format' given more than once
error: could not compile `demo` (bin "demo")
Possible Solution(s)
I haven't looked in the code but I guess something else is setting --error-format in the rust argv and that needs to be reconciled with or override RUSTFLAGS.
Notes
This was reported in sourcefrog/cargo-mutants#136 but it turns out the behavior is easily reproduced in cargo alone.
This looks like #11452 (but it's not about --target) and #6375 (but it's not about build.rs or cross compilation), so I think it's a distinct new bug, but perhaps the solution is the same.
If you want JSON output, the correct way to do that is cargo --message-format=json. Generally, using RUSTFLAGS should only be done for very advanced use cases, in situations where it is understood how the flags will interact with cargo (and understand that it may break in the future).
Problem
If
RUSTFLAGS
sets--error-format
thencargo-build
fails.Steps
Possible Solution(s)
I haven't looked in the code but I guess something else is setting
--error-format
in the rust argv and that needs to be reconciled with or overrideRUSTFLAGS
.Notes
This was reported in sourcefrog/cargo-mutants#136 but it turns out the behavior is easily reproduced in cargo alone.
This looks like #11452 (but it's not about
--target
) and #6375 (but it's not aboutbuild.rs
or cross compilation), so I think it's a distinct new bug, but perhaps the solution is the same.Version
It fails the same way on nightly:
The text was updated successfully, but these errors were encountered: