]> git.proxmox.com Git - cargo.git/log
cargo.git
6 years agoHandle opening browser with `opener` crate
Brian Bowman [Thu, 9 Aug 2018 04:37:56 +0000 (23:37 -0500)]
Handle opening browser with `opener` crate

Fixes #5701

6 years agoAuto merge of #5887 - Seeker14491:job-fix, r=alexcrichton
bors [Tue, 14 Aug 2018 00:21:54 +0000 (00:21 +0000)]
Auto merge of #5887 - Seeker14491:job-fix, r=alexcrichton

 Don't kill child processes on normal exit on Windows

Fix for #5598

6 years agoRemove unused imports
Brian Bowman [Mon, 13 Aug 2018 21:47:40 +0000 (16:47 -0500)]
Remove unused imports

6 years agoMerge remote-tracking branch 'origin/master' into job-fix
Brian Bowman [Mon, 13 Aug 2018 21:05:53 +0000 (16:05 -0500)]
Merge remote-tracking branch 'origin/master' into job-fix

6 years agoDon't kill child processes on normal exit on Windows
Brian Bowman [Mon, 13 Aug 2018 20:47:20 +0000 (15:47 -0500)]
Don't kill child processes on normal exit on Windows

Fixes #5598

6 years agoFix typo
Brian Bowman [Mon, 13 Aug 2018 20:36:20 +0000 (15:36 -0500)]
Fix typo

6 years agoAuto merge of #5876 - matthiaskrgr:clippy_2, r=alexcrichton
bors [Sun, 12 Aug 2018 22:42:53 +0000 (22:42 +0000)]
Auto merge of #5876 - matthiaskrgr:clippy_2, r=alexcrichton

fix a bunch of clippy warnings

 (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )

6 years agoAuto merge of #5879 - dwijnand:short-errors, r=alexcrichton
bors [Sun, 12 Aug 2018 15:00:55 +0000 (15:00 +0000)]
Auto merge of #5879 - dwijnand:short-errors, r=alexcrichton

Add support for rustc's --error-format short

Running a local build of this branch on some broken code shows this kind of output:

    18:42:29 $ dcargo check --message-format=short --tests
        Checking bufstream v0.1.3
        Checking cargo v0.30.0 (file:///d/cargo)
    tests/testsuite/config.rs:298:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:307:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:363:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:367:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:371:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:375:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:382:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:386:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:400:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:428:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:479:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:491:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:496:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:501:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:506:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:512:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:582:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:660:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:666:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:672:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:678:9: error[E0308]: mismatched types
    error: aborting due to 21 previous errors
    error: Could not compile `cargo`.
    warning: build failed, waiting for other jobs to finish...
    error: build failed

Rehash of @QuietMisdreavus' #4720 now that `--short-message` is stable (thanks for the ping @pickfire!).

Feedback welcome.

6 years agofix a bunch of clippy warnings (invocation: cargo clippy --all-targets --all-features...
Matthias Krüger [Wed, 8 Aug 2018 22:57:20 +0000 (00:57 +0200)]
fix a bunch of clippy warnings (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )

Special thanks to dwijnand for helping me with this! :)

6 years agoAdd a test for "cargo doc --message-format=short"
Dale Wijnand [Fri, 10 Aug 2018 07:44:36 +0000 (08:44 +0100)]
Add a test for "cargo doc --message-format=short"

6 years agoExtract & reuse add_error_format for rustdoc too
Dale Wijnand [Fri, 10 Aug 2018 07:27:49 +0000 (08:27 +0100)]
Extract & reuse add_error_format for rustdoc too

6 years agoAdd a test for "cargo check --message-format=short"
Dale Wijnand [Thu, 9 Aug 2018 20:13:42 +0000 (21:13 +0100)]
Add a test for "cargo check --message-format=short"

6 years agoAdd support for rustc's --error-format short
Dale Wijnand [Thu, 9 Aug 2018 17:54:19 +0000 (18:54 +0100)]
Add support for rustc's --error-format short

Running a local build of this branch on some broken code shows this kind of output:

    18:42:29 $ dcargo check --message-format=short --tests
        Checking bufstream v0.1.3
        Checking cargo v0.30.0 (file:///d/cargo)
    tests/testsuite/config.rs:298:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:307:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:363:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:367:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:371:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:375:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:382:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:386:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:400:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:428:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:479:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:491:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:496:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:501:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:506:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:512:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:582:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:660:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:666:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:672:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:678:9: error[E0308]: mismatched types
    error: aborting due to 21 previous errors
    error: Could not compile `cargo`.
    warning: build failed, waiting for other jobs to finish...
    error: build failed

6 years agoAuto merge of #5878 - ehuss:rustdoc-json, r=alexcrichton
bors [Fri, 10 Aug 2018 03:14:33 +0000 (03:14 +0000)]
Auto merge of #5878 - ehuss:rustdoc-json, r=alexcrichton

Support JSON with rustdoc.

This allows `cargo doc --message-format=json` to actually work.

Note that this explicitly does not attempt to support it for doctests for
several reasons:
- `rustdoc --test --error-format=json` does not work for some reason.
- Since the lib is usually compiled before running rustdoc, warnings/errors
  will be emitted correctly by rustc.
- I'm unaware of any errors/warnings `rustdoc --test` is capable of producing
  assuming the code passed `rustc`.
- The compilation of the tests themselves do not support JSON.
- libtest does not output json, so it's utility is limited.

6 years agoAuto merge of #5880 - dwijnand:fix-rustfmt-instructions, r=alexcrichton
bors [Fri, 10 Aug 2018 00:57:49 +0000 (00:57 +0000)]
Auto merge of #5880 - dwijnand:fix-rustfmt-instructions, r=alexcrichton

Fix rustfmt instructions in CONTRIBUTING.md

rustfmt's --skip-children is now behind --unstable-features
(rust-lang-nursery/rustfmt#2796) which only works on nightly rustfmt, so
change the install instructions too.

6 years agoUpdate for review comments.
Eric Huss [Thu, 9 Aug 2018 22:43:34 +0000 (15:43 -0700)]
Update for review comments.

6 years agoFix rustfmt instructions in CONTRIBUTING.md
Dale Wijnand [Thu, 9 Aug 2018 20:21:13 +0000 (21:21 +0100)]
Fix rustfmt instructions in CONTRIBUTING.md

rustfmt's --skip-children is now behind --unstable-features
(rust-lang-nursery/rustfmt#2796) which only works on nightly rustfmt, so
change the install instructions too.

6 years agoSupport JSON with rustdoc.
Eric Huss [Thu, 9 Aug 2018 06:52:05 +0000 (23:52 -0700)]
Support JSON with rustdoc.

This allows `cargo doc --message-format=json` to actually work.

Note that this explicitly does not attempt to support it for doctests for
several reasons:
- `rustdoc --test --error-format=json` does not work for some reason.
- Since the lib is usually compiled before running rustdoc, warnings/errors
  will be emitted correctly by rustc.
- I'm unaware of any errors/warnings `rustdoc --test` is capable of producing
  assuming the code passed `rustc`.
- The compilation of the tests themselves do not support JSON.
- libtest does not output json, so it's utility is limited.

6 years agoAuto merge of #5877 - ehuss:ws-run, r=alexcrichton
bors [Thu, 9 Aug 2018 04:46:23 +0000 (04:46 +0000)]
Auto merge of #5877 - ehuss:ws-run, r=alexcrichton

Allow `cargo run` in workspaces.

Closes #3713

6 years agoAllow `cargo run` in workspaces.
Eric Huss [Thu, 9 Aug 2018 00:38:04 +0000 (17:38 -0700)]
Allow `cargo run` in workspaces.

6 years agoAuto merge of #5873 - ehuss:ws-filters, r=alexcrichton
bors [Tue, 7 Aug 2018 22:57:38 +0000 (22:57 +0000)]
Auto merge of #5873 - ehuss:ws-filters, r=alexcrichton

Change target filters in workspaces.

This changes it so that filters like `--bin`, `--test`, `--example`,
`--bench`, `--lib` will work in a workspace.  Today, these filters
require that they match *every* package in a workspace which makes
them not very useful.  This change makes it so that they only must
match at least one package.

Closes #5819.

6 years agoAuto merge of #5858 - dekellum:git-check-logging-and-test, r=alexcrichton
bors [Tue, 7 Aug 2018 22:19:54 +0000 (22:19 +0000)]
Auto merge of #5858 - dekellum:git-check-logging-and-test, r=alexcrichton

Improve verbose console and log for finding git repo in package check

Third attempt to resolve #5823 by improving logging and tests. This exposes the issue to testing,  via verbose console output and is dependent on alexcrichton/git2-rs#341 as just released in git2 0.7.5 crate. Thus tests *should* now pass on all platforms, incl. windows, but I also intend to bump the minimal git2 release dependency (in a subsequently added commit).

cc: @Eh2406 thanks for your fix and help!

6 years agoAuto merge of #5871 - matklad:meta-rename, r=alexcrichton
bors [Tue, 7 Aug 2018 20:48:07 +0000 (20:48 +0000)]
Auto merge of #5871 - matklad:meta-rename, r=alexcrichton

Meta rename

Some work towards https://github.com/rust-lang/cargo/issues/5583

Previously, `cargo metadata` exposed dependencies info as a graph of
package id without any additional information on edges.

However, we do want to add some data to edges, including for example,
package renames and `cfg` info.

Internally, the edges info is represented as a `Vec<Dependnecy>`. We
could have exposed that directly, but that risks exposing and
ossifying an implementation details.

So instead we collapse a `Vec<Dependnecy>` to a single JSON object,
which at the moment contains `id` and `rename` info only. It should be
possible to add additional fields to that object backwards compatibly.
Such representation does not correspond directly to any internal Cargo
data structure, but hopefully it shouldn't be to hard to maintain.

This representation also does not quite correspond to the "real
world", where dependencies are between crate (cargo targets), and not
packages. However, because each dep edge is a JSON object, adding a
target filter should be possible, which would handle dev-, build-, and
potential future bin-specific dependencies backwards-compatibly.

6 years agoChange target filters in workspaces.
Eric Huss [Tue, 7 Aug 2018 20:05:22 +0000 (13:05 -0700)]
Change target filters in workspaces.

This changes it so that filters like `--bin`, `--test`, `--example`,
`--bench`, `--lib` will work in a workspace.  Today, these filters
require that they match *every* package in a workspace which makes
them not very useful.  This change makes it so that they only must
match at least one package.

6 years agoAdd rename info to Cargo metadata
Aleksey Kladov [Tue, 7 Aug 2018 09:37:29 +0000 (12:37 +0300)]
Add rename info to Cargo metadata

Previously, `cargo metadata` exposed dependencies info as a graph of
package id without any additional information on edges.

However, we do want to add some data to edges, including for example,
package renames and `cfg` info.

Internally, the edges info is represented as a `Vec<Dependnecy>`. We
could have exposed that directly, but that risks exposing and
ossifying an implementation details.

So instead we collapse a `Vec<Dependnecy>` to a single JSON object,
which at the moment contains `id` and `rename` info only. It should be
possible to add additional fields to that object backwards compatibly.
Such representation does not correspond directly to any internal Cargo
data structure, but hopefully it shouldn't be to hard to maintain.

This representation also does not quite correspond to the "real
world", where dependencies are between crate (cargo targets), and not
packages. However, because each dep edge is a JSON object, adding a
target filter should be possible, which would handle dev-, build-, and
potential future bin-specific dependencies backwards-compatibly.

6 years agoMove extern_crate_name to Resolve
Aleksey Kladov [Tue, 7 Aug 2018 09:11:10 +0000 (12:11 +0300)]
Move extern_crate_name to Resolve

6 years agoAuto merge of #5870 - bmwill:fix-fetch-target-tests, r=alexcrichton
bors [Mon, 6 Aug 2018 17:31:07 +0000 (17:31 +0000)]
Auto merge of #5870 - bmwill:fix-fetch-target-tests, r=alexcrichton

fetch: skip target tests when cross_compile is disabled

It was reported in #5864 that the fetch-by-target tests fail when run on a non-x86 platform.  This is due to the cross_compile module being disabled when running on non-x86 platforms.  Fix this by skipping the two fetch tests which rely on the cross_compile module, when cross_compile has been disabled.

Signed-off-by: Brandon Williams <bmwill@google.com>
6 years agofetch: skip target tests when cross_compile is disabled
Brandon Williams [Mon, 6 Aug 2018 17:04:53 +0000 (10:04 -0700)]
fetch: skip target tests when cross_compile is disabled

Signed-off-by: Brandon Williams <bmwill@google.com>
6 years agoAuto merge of #5862 - kennytm:capture-rustc-output, r=alexcrichton
bors [Mon, 6 Aug 2018 15:12:01 +0000 (15:12 +0000)]
Auto merge of #5862 - kennytm:capture-rustc-output, r=alexcrichton

Fully capture rustc and rustdoc output when -Zcompile-progress is passed

Fixes #5764 and #5695.

On Windows, we will parse the ANSI escape code into console commands via my `fwdansi` package, based on @ishitatsuyuki's idea in https://github.com/rust-lang/cargo/issues/5695#issuecomment-406300234. Outside of Windows the content is forwarded as-is.

6 years agoAuto merge of #5867 - ehuss:test-example-help, r=alexcrichton
bors [Sun, 5 Aug 2018 16:58:27 +0000 (16:58 +0000)]
Auto merge of #5867 - ehuss:test-example-help, r=alexcrichton

Fix test --example docs.

As part of #5464 I forgot to update the help text.

Closes #5177

6 years agoFix test --example docs.
Eric Huss [Sun, 5 Aug 2018 15:47:55 +0000 (08:47 -0700)]
Fix test --example docs.

As part of #5464 I forgot to update the help text.

Closes #5177

6 years agoAuto merge of #5865 - alexcrichton:vendor-openssl, r=matklad
bors [Sun, 5 Aug 2018 09:26:06 +0000 (09:26 +0000)]
Auto merge of #5865 - alexcrichton:vendor-openssl, r=matklad

Add a feature to build a vendored OpenSSL

This will be enabled through rust-lang/rust to ensure that for dist builds we
can build a Cargo with a vendored OpenSSL

6 years agoAdd a feature to build a vendored OpenSSL
Alex Crichton [Sun, 5 Aug 2018 06:02:57 +0000 (23:02 -0700)]
Add a feature to build a vendored OpenSSL

This will be enabled through rust-lang/rust to ensure that for dist builds we
can build a Cargo with a vendored OpenSSL

6 years agoAuto merge of #5861 - alexcrichton:build-script-edition, r=ehuss
bors [Sat, 4 Aug 2018 18:15:43 +0000 (18:15 +0000)]
Auto merge of #5861 - alexcrichton:build-script-edition, r=ehuss

Fix the edition build scripts are compiled with

Previously build scripts were accidentally and unconditionally compiled with the
2015 edition, but they should instead use the edition of the `[package]` itself.

Closes #5860

6 years agoFix the edition build scripts are compiled with
Alex Crichton [Sat, 4 Aug 2018 15:44:16 +0000 (08:44 -0700)]
Fix the edition build scripts are compiled with

Previously build scripts were accidentally and unconditionally compiled with the
2015 edition, but they should instead use the edition of the `[package]` itself.

Closes #5860

6 years agoCapture output from rustc and rustdoc.
kennytm [Thu, 2 Aug 2018 14:18:43 +0000 (22:18 +0800)]
Capture output from rustc and rustdoc.

6 years agoAuto merge of #5852 - dwijnand:exit-code-0, r=alexcrichton
bors [Fri, 3 Aug 2018 15:42:54 +0000 (15:42 +0000)]
Auto merge of #5852 - dwijnand:exit-code-0, r=alexcrichton

Default test support's Execs to exit code 0

Refs #5742

6 years agoAuto merge of #5859 - jeizsm:master, r=alexcrichton
bors [Fri, 3 Aug 2018 13:40:12 +0000 (13:40 +0000)]
Auto merge of #5859 - jeizsm:master, r=alexcrichton

check target env in test when use targets

Hello. It also should check for target vendor but it's still unstable for some reason https://github.com/rust-lang/rust/issues/29718

6 years agoDrop niche Execs::with_no_expected_status
Dale Wijnand [Thu, 2 Aug 2018 13:57:19 +0000 (14:57 +0100)]
Drop niche Execs::with_no_expected_status

.. by gating the nightly-only tests.

6 years agoFix tests that have no stable expected exit code
Dale Wijnand [Thu, 2 Aug 2018 12:51:00 +0000 (13:51 +0100)]
Fix tests that have no stable expected exit code

6 years agoFix tests that have failing commands w/o specifying the exit code
Dale Wijnand [Thu, 2 Aug 2018 11:48:37 +0000 (12:48 +0100)]
Fix tests that have failing commands w/o specifying the exit code

6 years agoDefault test support's Execs to exit code 0
Dale Wijnand [Thu, 2 Aug 2018 10:29:39 +0000 (11:29 +0100)]
Default test support's Execs to exit code 0

6 years agocheck target env in test when use targets
Marat Safin [Fri, 3 Aug 2018 04:39:34 +0000 (07:39 +0300)]
check target env in test when use targets

6 years agoUpdate git2 minimal version to 0.7.5 for a fix
David Kellum [Thu, 2 Aug 2018 22:46:19 +0000 (15:46 -0700)]
Update git2 minimal version to 0.7.5 for a fix

6 years agoMerge branch 'master' into git-check-logging-and-test
David Kellum [Thu, 2 Aug 2018 22:42:50 +0000 (15:42 -0700)]
Merge branch 'master' into git-check-logging-and-test

6 years agoImprove verbose console and logging for finding git repo in package check
David Kellum [Sat, 28 Jul 2018 14:20:33 +0000 (07:20 -0700)]
Improve verbose console and logging for finding git repo in package check

6 years agoAuto merge of #5854 - dwijnand:args-split_whitespace, r=alexcrichton
bors [Thu, 2 Aug 2018 22:12:33 +0000 (22:12 +0000)]
Auto merge of #5854 - dwijnand:args-split_whitespace, r=alexcrichton

Cleanup tests by using single string commands, split on whitespaces

Refs #5742

6 years agoAuto merge of #5857 - matthiaskrgr:borrowck_mut, r=alexcrichton
bors [Thu, 2 Aug 2018 20:55:07 +0000 (20:55 +0000)]
Auto merge of #5857 - matthiaskrgr:borrowck_mut, r=alexcrichton

fix borrowck-migrate unused mut warnings.

6 years agofix borrowck-migrate unused mut warnings.
Matthias Krüger [Thu, 2 Aug 2018 20:34:55 +0000 (22:34 +0200)]
fix borrowck-migrate unused mut warnings.

6 years agoFix install_empty_argument by passing an empty arg
Dale Wijnand [Thu, 2 Aug 2018 16:57:24 +0000 (17:57 +0100)]
Fix install_empty_argument by passing an empty arg

6 years agoIntroduce git_process too
Dale Wijnand [Thu, 2 Aug 2018 14:27:06 +0000 (15:27 +0100)]
Introduce git_process too

6 years agoMake cargo_process take a string it splits on whitespace
Dale Wijnand [Thu, 2 Aug 2018 14:17:56 +0000 (15:17 +0100)]
Make cargo_process take a string it splits on whitespace

6 years agoAuto merge of #5843 - alexcrichton:idioms-for, r=alexcrichton
bors [Thu, 2 Aug 2018 16:50:42 +0000 (16:50 +0000)]
Auto merge of #5843 - alexcrichton:idioms-for, r=alexcrichton

Add a `--edition-idioms` flag to `cargo fix`

This, like `--prepare-for`, will be part of the transition guide which
automatically applies the necessary lint group from the compiler to associated
code.

cc rust-lang/rust#52679

6 years agoAdd a `--edition-idioms` flag to `cargo fix`
Alex Crichton [Tue, 31 Jul 2018 22:42:38 +0000 (15:42 -0700)]
Add a `--edition-idioms` flag to `cargo fix`

This, like `--prepare-for`, will be part of the transition guide which
automatically applies the necessary lint group from the compiler to associated
code.

The `--edition-idioms` flag does not take an argument and will automatically
enable the right lint group based on the edition being compiled for.

cc #52679

6 years agoAuto merge of #5845 - alexcrichton:fix-edition, r=alexcrichton
bors [Thu, 2 Aug 2018 14:57:35 +0000 (14:57 +0000)]
Auto merge of #5845 - alexcrichton:fix-edition, r=alexcrichton

Rename `--prepare-for` to `--edition`, drop arg

This commit tweaks the UI of `cargo fix` for the edition. Previously you'd
execute `cargo fix --prepare-for 2018`, but that's a lot of typing! Plus it's
some manual data that Cargo can already infer.

Instead, after this commit, you now type `cargo fix --edition`, and that's it!
The idea is that this'll tell Cargo to fix code for the *next* edition,
inferring whatever edition is in use and figuring out what to pass to rustc.

Functionality-wise this should be the exact same as `--prepare-for 2018` though

If others agree w/ this change I'll send a PR to the edition guide after this
merges!

6 years agoUse p.cargo's ability to split on whitespace more
Dale Wijnand [Thu, 2 Aug 2018 12:59:54 +0000 (13:59 +0100)]
Use p.cargo's ability to split on whitespace more

6 years agoAlways forward `--color` to rustc and rustdoc.
kennytm [Thu, 19 Jul 2018 01:03:55 +0000 (09:03 +0800)]
Always forward `--color` to rustc and rustdoc.

This prepares us for capturing output from these compilers.

6 years agoAuto merge of #5851 - dwijnand:slash-macro, r=alexcrichton
bors [Thu, 2 Aug 2018 13:34:57 +0000 (13:34 +0000)]
Auto merge of #5851 - dwijnand:slash-macro, r=alexcrichton

Drop the [/] test output macro

Refs #5742

6 years agoPush slash conforming to lines_match, so match_json uses it
Dale Wijnand [Thu, 2 Aug 2018 10:43:26 +0000 (11:43 +0100)]
Push slash conforming to lines_match, so match_json uses it

6 years agoDrop the [/] test output macro
Dale Wijnand [Thu, 2 Aug 2018 09:18:48 +0000 (10:18 +0100)]
Drop the [/] test output macro

6 years agoSwitch strategies for how rustc's workspace is unioned
Alex Crichton [Thu, 2 Aug 2018 04:28:47 +0000 (21:28 -0700)]
Switch strategies for how rustc's workspace is unioned

See rust-lang/rust#52919 for more details.

6 years agoRename `--prepare-for` to `--edition`, drop arg
Alex Crichton [Wed, 1 Aug 2018 00:01:09 +0000 (17:01 -0700)]
Rename `--prepare-for` to `--edition`, drop arg

This commit tweaks the UI of `cargo fix` for the edition. Previously you'd
execute `cargo fix --prepare-for 2018`, but that's a lot of typing! Plus it's
some manual data that Cargo can already infer.

Instead, after this commit, you now type `cargo fix --edition`, and that's it!
The idea is that this'll tell Cargo to fix code for the *next* edition,
inferring whatever edition is in use and figuring out what to pass to rustc.

Functionality-wise this should be the exact same as `--prepare-for 2018` though

If others agree w/ this change I'll send a PR to the edition guide after this
merges!

6 years agoAuto merge of #5831 - Eh2406:i5684, r=alexcrichton
bors [Wed, 1 Aug 2018 16:39:58 +0000 (16:39 +0000)]
Auto merge of #5831 - Eh2406:i5684, r=alexcrichton

cargo can silently fix some bad lockfiles (use --locked to disable)

Lock files often get corrupted by git merge. This makes all cargo commands silently fix that kind of corruption.

If you want to be sure that your CI does not change the lock file you have commited
---

Then make sure to use `--locked` in your CI

Edit: original description below

---------------

This is a continuation of @dwijnand work in #5809, and closes #5684

This adds a `ignore_errors` arg to reading a lock file which ignores sections it doesn't understand. Specifically things that depend on versions that don't exist in the lock file. Then all users pass false except for the two that relate to `update` command.

I think the open questions for this pr relate to testing.
- Now that we are passing false in all other commands, do they each need a test for a bad lockfile?
- Do we need a test with a more subtly corrupted lock file, or is this always sufficient for `update` to clean up?

6 years agoAuto merge of #5834 - Undin:metadata-edition, r=alexcrichton
bors [Wed, 1 Aug 2018 15:51:56 +0000 (15:51 +0000)]
Auto merge of #5834 - Undin:metadata-edition, r=alexcrichton

Add edition info into metadata

Since edition feature was introduced, external tools have to support this new feature.
But cargo metadata doesn't provide info about package edition.
This commit adds edition field to `SerializedPackage` struct to add the corresponding field into metadata output.

6 years agoAuto merge of #5847 - alexcrichton:fix-deprecations, r=alexcrichton
bors [Wed, 1 Aug 2018 14:21:03 +0000 (14:21 +0000)]
Auto merge of #5847 - alexcrichton:fix-deprecations, r=alexcrichton

Upgrade to `failure 0.1.2` idioms

Fixes some deprecation warnings in Cargo

6 years agoUpgrade to `failure 0.1.2` idioms
Alex Crichton [Wed, 1 Aug 2018 14:20:04 +0000 (07:20 -0700)]
Upgrade to `failure 0.1.2` idioms

Fixes some deprecation warnings in Cargo

6 years agoRefactor: Don't even send out the build script stdout without -vv.
kennytm [Wed, 18 Jul 2018 23:55:39 +0000 (07:55 +0800)]
Refactor: Don't even send out the build script stdout without -vv.

JobQueue::drain_the_queue() could thus stop checking for `extra_verbose()`.

6 years agofix tests on Windows
Arseniy Pendryak [Wed, 1 Aug 2018 06:04:55 +0000 (09:04 +0300)]
fix tests on Windows

6 years agoAuto merge of #5842 - alexcrichton:fix-lots, r=ehuss
bors [Wed, 1 Aug 2018 02:52:35 +0000 (02:52 +0000)]
Auto merge of #5842 - alexcrichton:fix-lots, r=ehuss

fix: Iteratively apply suggestions from the compiler

This commit updates the `cargo fix` implementation to iteratively apply fixes
from the compiler instead of only once. Currently the compiler can sometimes
emit overlapping suggestions, such as in the case of transitioning

    ::foo::<::Bar>();

to ...

    crate::foo::<crate::Bar>();

and `rustfix` rightfully can't handle overlapping suggestions as there's no
clear way of how to disambiguate the fixes. To fix this problem Cargo will now
run `rustc` and `rustfix` multiple times, attempting to reach a steady state
where no fixes failed to apply.

Naturally this is a pretty tricky thing to do and we want to be sure that Cargo
doesn't loop forever, for example. A number of safeguards are in place to
prevent Cargo from going off into the weeds when fixing files, notably avoiding
to reattempt fixes if no successful fixes ended up being applied.

Closes #5813
Closes rust-lang/rust#52754

6 years agoAuto merge of #5841 - Mark-Simulacrum:internal-error-json, r=alexcrichton
bors [Wed, 1 Aug 2018 01:24:42 +0000 (01:24 +0000)]
Auto merge of #5841 - Mark-Simulacrum:internal-error-json, r=alexcrichton

Consider rustc failure internal despite JSON formatting

@eddyb noted this on IRC I believe, this should make compiler devs in general happy in 6 weeks once this lands onto beta

r? @alexcrichton

6 years agoAuto merge of #5840 - ehuss:uninstall-spec, r=alexcrichton
bors [Tue, 31 Jul 2018 23:28:18 +0000 (23:28 +0000)]
Auto merge of #5840 - ehuss:uninstall-spec, r=alexcrichton

Allow `-p` in `uninstall` to accommodate error messages.

The ambiguous spec error tells you to use `-p` which wasn't available for
this command.

Fixes #5006

6 years agoAdd edition field into target object in metadata as well
Arseniy Pendryak [Tue, 31 Jul 2018 22:29:48 +0000 (01:29 +0300)]
Add edition field into target object in metadata as well

6 years agoAuto merge of #5836 - kornelski:profiledebug, r=alexcrichton
bors [Tue, 31 Jul 2018 21:37:35 +0000 (21:37 +0000)]
Auto merge of #5836 - kornelski:profiledebug, r=alexcrichton

Hint correct name of profile.debug

Cargo talks about "debug" and "release" builds, but there are "dev" and "release" profiles. [This is a gotcha](https://users.rust-lang.org/t/rust-emscripten-emterpreter/19215/5). I've added an explicit hint that `profile.debug` is supposed to be `profile.dev`.

6 years agofix: Iteratively apply suggestions from the compiler
Alex Crichton [Tue, 31 Jul 2018 20:08:46 +0000 (13:08 -0700)]
fix: Iteratively apply suggestions from the compiler

This commit updates the `cargo fix` implementation to iteratively apply fixes
from the compiler instead of only once. Currently the compiler can sometimes
emit overlapping suggestions, such as in the case of transitioning

    ::foo::<::Bar>();

to ...

    crate::foo::<crate::Bar>();

and `rustfix` rightfully can't handle overlapping suggestions as there's no
clear way of how to disambiguate the fixes. To fix this problem Cargo will now
run `rustc` and `rustfix` multiple times, attempting to reach a steady state
where no fixes failed to apply.

Naturally this is a pretty tricky thing to do and we want to be sure that Cargo
doesn't loop forever, for example. A number of safeguards are in place to
prevent Cargo from going off into the weeds when fixing files, notably avoiding
to reattempt fixes if no successful fixes ended up being applied.

Closes #5813
Closes rust-lang/rust#52754

6 years agoAuto merge of #5835 - dwijnand:clippy, r=alexcrichton
bors [Tue, 31 Jul 2018 20:26:45 +0000 (20:26 +0000)]
Auto merge of #5835 - dwijnand:clippy, r=alexcrichton

Resolve some Clippy warnings

I'm not sure how these popped up since my PR 8 days ago.

My current hypotheses:
* changes in latest nightly rust/clippy
* new or changed cargo code
* I missed these as I was only touching `src/bin/cargo/main.rs`

For future reference I now iterate with:

    touch src/bin/cargo/main.rs src/cargo/lib.rs && cargo +nightly clippy

6 years agoMove all clippy config to target top files
Dale Wijnand [Tue, 31 Jul 2018 20:02:15 +0000 (21:02 +0100)]
Move all clippy config to target top files

6 years agoAdd edition field into metadata.
Arseniy Pendryak [Mon, 30 Jul 2018 22:08:16 +0000 (01:08 +0300)]
Add edition field into metadata.

Since edition feature was introduced, external tools have to support this new feature.
But cargo metadata doesn't provide info about package edition.
This commit adds edition field to SerializedPackage struct
to add the corresponding field into metadata output.

6 years agoAuto merge of #5824 - alexcrichton:careful-transition, r=alexcrichton
bors [Tue, 31 Jul 2018 19:28:52 +0000 (19:28 +0000)]
Auto merge of #5824 - alexcrichton:careful-transition, r=alexcrichton

Add more diagnostics to smooth edition transition

This commit adds two diagnostics in particular to ease the transition into the
2018 edition. The current transition process is pretty particular and must be
done carefully, so let's try to automate things to make it as painless as
possible! Notably the new diagnostics are:

* If you `cargo fix --prepare-for 2018` a crate which already has the 2018
  edition enabled, then an error is generated. This is because the compiler
  can't prepare for the 2018 edition if you're already in the 2018 edition, the
  lints won't have a chance to fire. You can only execute `--prepare-for 2018`
  over crates in the 2015 edition.

* If you `cargo fix --prepare-for 2018` and have forgotten the
  `rust_2018_preview` feature, a warning is issued. The lints don't fire unless
  the feature is enabled, so this is intended to warn in this situation to
  ensure that lints fire as much as they can.

After this commit if `cargo fix --prepare-for` exits successfully with zero
warnings then crates should be guaranteed to be compatible!

Closes #5778

6 years agoConsider rustc failure internal despite JSON formatting
Mark Rousskov [Tue, 31 Jul 2018 19:27:17 +0000 (13:27 -0600)]
Consider rustc failure internal despite JSON formatting

6 years agoremove `missing from the package list` error and fmt
Eh2406 [Tue, 31 Jul 2018 18:58:34 +0000 (14:58 -0400)]
remove `missing from the package list` error and fmt

6 years agoAllow `-p` in `uninstall` to accommodate error messages.
Eric Huss [Tue, 31 Jul 2018 18:50:09 +0000 (11:50 -0700)]
Allow `-p` in `uninstall` to accommodate error messages.

The ambiguous spec error tells you to use `-p` which wasn't available for
this command.

Fixes #5006

6 years agoAuto merge of #5811 - alexcrichton:rename-crate-feature-names, r=ehuss
bors [Tue, 31 Jul 2018 18:18:17 +0000 (18:18 +0000)]
Auto merge of #5811 - alexcrichton:rename-crate-feature-names, r=ehuss

Use listed dependency name for feature names

This commit updates the implementation of renamed dependencies to use the listed
name of a dependency in Cargo.toml for the name of the associated feature,
rather than using the package name. This'll allow disambiguating between
different packages of the same name and was the intention all along!

Closes #5753

6 years agoAuto merge of #5816 - dwijnand:edtion-per-target, r=alexcrichton
bors [Tue, 31 Jul 2018 17:10:10 +0000 (17:10 +0000)]
Auto merge of #5816 - dwijnand:edtion-per-target, r=alexcrichton

Edition key should be per-target, not per-package

Fixes #5661

I've pushed this WIP PR as I'd love some early feedback on it and some tips on:

* how to best to make it fail if edition is set on a target, but the feature isn't set; and
* what tests this should include (i.e how exhaustive should I go)

Thanks!

6 years agoUse listed dependency name for feature names
Alex Crichton [Thu, 26 Jul 2018 19:56:32 +0000 (12:56 -0700)]
Use listed dependency name for feature names

This commit updates the implementation of renamed dependencies to use the listed
name of a dependency in Cargo.toml for the name of the associated feature,
rather than using the package name. This'll allow disambiguating between
different packages of the same name and was the intention all along!

Closes #5753

6 years agoAdd more diagnostics to smooth edition transition
Alex Crichton [Sat, 28 Jul 2018 20:22:32 +0000 (13:22 -0700)]
Add more diagnostics to smooth edition transition

This commit adds two diagnostics in particular to ease the transition into the
2018 edition. The current transition process is pretty particular and must be
done carefully, so let's try to automate things to make it as painless as
possible! Notably the new diagnostics are:

* If you `cargo fix --prepare-for 2018` a crate which already has the 2018
  edition enabled, then an error is generated. This is because the compiler
  can't prepare for the 2018 edition if you're already in the 2018 edition, the
  lints won't have a chance to fire. You can only execute `--prepare-for 2018`
  over crates in the 2015 edition.

* If you `cargo fix --prepare-for 2018` and have forgotten the
  `rust_2018_preview` feature, a warning is issued. The lints don't fire unless
  the feature is enabled, so this is intended to warn in this situation to
  ensure that lints fire as much as they can.

After this commit if `cargo fix --prepare-for` exits successfully with zero
warnings then crates should be guaranteed to be compatible!

Closes #5778

6 years agoResolve a single_match lint warning
Dale Wijnand [Tue, 31 Jul 2018 08:57:54 +0000 (09:57 +0100)]
Resolve a single_match lint warning

6 years agoExempt 2 wrong_self_convention lint warnings
Dale Wijnand [Tue, 31 Jul 2018 08:56:08 +0000 (09:56 +0100)]
Exempt 2 wrong_self_convention lint warnings

6 years agoResolve a trivially_copy_pass_by_ref lint warning
Dale Wijnand [Tue, 31 Jul 2018 08:46:33 +0000 (09:46 +0100)]
Resolve a trivially_copy_pass_by_ref lint warning

6 years agoResolve a wrong_self_convention lint warning
Dale Wijnand [Tue, 31 Jul 2018 08:43:23 +0000 (09:43 +0100)]
Resolve a wrong_self_convention lint warning

6 years agoResolve a wrong_self_convention lint warning
Dale Wijnand [Tue, 31 Jul 2018 08:39:30 +0000 (09:39 +0100)]
Resolve a wrong_self_convention lint warning

.. by inlining & removing `Members::is_empty`.

For details see
https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#wrong_self_convention

Asides from opt-ing out, the alternative I saw was calling it
"into_empty" and make it return a little

    enum Empty { Empty, NonEmpty }

type.

6 years agoResolve 2 needless_pass_by_value lint warnings
Dale Wijnand [Tue, 31 Jul 2018 08:32:57 +0000 (09:32 +0100)]
Resolve 2 needless_pass_by_value lint warnings

TIL Rust doesn't have equational reasoning.. :-/
(can't inline the new "exec" bindings)

6 years agoAdd tests for per-target edition
Dale Wijnand [Tue, 31 Jul 2018 13:49:33 +0000 (14:49 +0100)]
Add tests for per-target edition

Test:
* enabling edition feature & setting at target level (happy path)
* overriding the package-level edition with per-target edition
* feature gating of per-target edition
* per-target edition usage for rustdoc

6 years agoWire Features down to targets::configure to check the edition feature gate
Dale Wijnand [Tue, 31 Jul 2018 13:22:45 +0000 (14:22 +0100)]
Wire Features down to targets::configure to check the edition feature gate

6 years agoDocument per-target edition & give an example
Dale Wijnand [Tue, 31 Jul 2018 09:47:35 +0000 (10:47 +0100)]
Document per-target edition & give an example

6 years agoHint correct name of profile.debug
Kornel Lesiński [Tue, 31 Jul 2018 09:13:16 +0000 (10:13 +0100)]
Hint correct name of profile.debug

6 years agoExempt too_many_arguments throughout the cargo lib crate
Dale Wijnand [Tue, 31 Jul 2018 08:15:32 +0000 (09:15 +0100)]
Exempt too_many_arguments throughout the cargo lib crate

I'm confused.  Now this is duplicated with src/bin/cargo/main.rs and I
don't know how to avoid that.  Tips welcome.

6 years agoExempt 3 identity_op lint warnings
Dale Wijnand [Tue, 31 Jul 2018 08:10:45 +0000 (09:10 +0100)]
Exempt 3 identity_op lint warnings

6 years agofix: Only fix "primary" packages by default
Alex Crichton [Sat, 28 Jul 2018 17:38:34 +0000 (10:38 -0700)]
fix: Only fix "primary" packages by default

The previous heuristic for fixing packages was to fix all packages in a
workspace, aka those with path dependencies. Instead this commit switches cargo
over to only fixing the "primary" package, or those requested on the command
line or implicitly via cwd.

This will later help us identify which packages are being targeted so we can
provide tailored warnings and errors for mixed up transition steps.

6 years agoAuto merge of #5814 - alexcrichton:fix-all-targets, r=alexcrichton
bors [Mon, 30 Jul 2018 22:11:58 +0000 (22:11 +0000)]
Auto merge of #5814 - alexcrichton:fix-all-targets, r=alexcrichton

cargo fix: Pass `--all-targets` to `cargo fix` by default

This'll help fix as much code as possible, including tests!

Closes #5739

6 years agouse enum instead of bool
Eh2406 [Mon, 30 Jul 2018 21:30:55 +0000 (17:30 -0400)]
use enum instead of bool