Skip to content

Fix ‘cargo metadata’ call for cargo 0.19.0-nightly #53

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

Merged
merged 2 commits into from
Apr 2, 2017

Conversation

andersk
Copy link
Contributor

@andersk andersk commented Apr 2, 2017

flycheck-rust-get-cargo-targets was failing in json-read because of a new warning emitted by cargo 0.19.0-nightly. Fix the warning, and also discard stderr so that future warnings don’t break things in the same way.

andersk added 2 commits April 2, 2017 03:33
cargo 0.19.0-nightly otherwise complains to stderr:

warning: please specify `--format-version` flag explicitly to avoid
compatibility problems

We should heed this warning.  Additionally, since we tell call-process
to mix stdout and stderr into the same buffer, this warning’s presence
was confusing json-read.

Signed-off-by: Anders Kaseorg <[email protected]>
We should not attempt to parse warnings or errors from cargo as
JSON.

Signed-off-by: Anders Kaseorg <[email protected]>
@fmdkdd
Copy link
Member

fmdkdd commented Apr 2, 2017

Thanks for the fix 👍

Is --format-verison available on Rust 1.15 and up? (I'm confused by the version numbering of cargo vs. rustc).

@andersk
Copy link
Contributor Author

andersk commented Apr 2, 2017

Yes, it has been available since cargo metadata was first merged (rust-lang/cargo#2196).

$ cargo +1.15.1 version
cargo 0.16.0-nightly (6e0c18c 2017-01-27)
$ cargo +1.15.1 help metadata 
Output the resolved dependencies of a project, the concrete used versions
including overrides, in machine-readable format.

Usage:
    cargo metadata [options]

Options:
    -h, --help                 Print this message
    --features FEATURES        Space-separated list of features
    --all-features             Build all available features
    --no-default-features      Do not include the `default` feature
    --no-deps                  Output information only about the root package
                               and don't fetch dependencies.
    --manifest-path PATH       Path to the manifest
    --format-version VERSION   Format version [default: 1]
                               Valid values: 1
    -v, --verbose ...          Use verbose output (-vv very verbose/build.rs output)
    -q, --quiet                No output printed to stdout
    --color WHEN               Coloring: auto, always, never
    --frozen                   Require Cargo.lock and cache are up to date
    --locked                   Require Cargo.lock is up to date

@fmdkdd fmdkdd merged commit 5d08b16 into flycheck:master Apr 2, 2017
@fmdkdd
Copy link
Member

fmdkdd commented Apr 2, 2017

Hah! Nice trick there $ cargo +1.15.1 version for testing this :)

LGTM, thanks!

@andersk andersk deleted the cargo-metadata-nightly branch April 2, 2017 09:33
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

Successfully merging this pull request may close these issues.

2 participants