]> git.proxmox.com Git - cargo.git/log
cargo.git
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 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

6 years agoAuto merge of #5832 - Eh2406:collect_seq, r=alexcrichton
bors [Mon, 30 Jul 2018 21:18:51 +0000 (21:18 +0000)]
Auto merge of #5832 - Eh2406:collect_seq, r=alexcrichton

remove some allocations in Serialize

I have know reason to think this is in the hot path, but don't allocate if we don't have to.

6 years agoremove some allocations in Serialize
Eh2406 [Mon, 30 Jul 2018 18:11:21 +0000 (14:11 -0400)]
remove some allocations in Serialize

6 years agocargo update can deal with some bad lockfiles
Eh2406 [Fri, 27 Jul 2018 18:32:02 +0000 (14:32 -0400)]
cargo update can deal with some bad lockfiles

6 years agoAuto merge of #5830 - Xanewok:executor-compile-mode, r=matklad
bors [Sun, 29 Jul 2018 20:56:35 +0000 (20:56 +0000)]
Auto merge of #5830 - Xanewok:executor-compile-mode, r=matklad

Add CompileMode to Executor callbacks

This came up when trying to fix https://github.com/rust-lang-nursery/rls/issues/876.

So currently in the RLS we recreate our own dep graph, where we store units with a key `(PackageId, TargetKind)`. This turned out to be not enough since
a) we can have multiple bin target kinds with different names (unrelated to this PR)
b) same package target kind (bin, lib) can be compiled regularly or including the test harness.
With this, we can distinguish these cases and properly rerun both regular compilation check and the one including unit tests.

Without this information we'd need to fall back on guessing whether the rustc invocation has `--test` but having this information makes it accurate and seems useful enough to add it to the callback arguments.

r? @alexcrichton or @matklad

6 years agoAdd CompileMode to Executor callbacks
Igor Matuszewski [Sun, 29 Jul 2018 19:18:36 +0000 (21:18 +0200)]
Add CompileMode to Executor callbacks

This helps distinguish whether a given rustc invocation corresponds to a
regular compilation or is it compiled as a test harness. The difference is
important for tools like RLS, since checking test code is different than
checking what is it regularly compiled as.

6 years agoAuto merge of #5828 - kennytm:compile-progress-names, r=alexcrichton
bors [Sun, 29 Jul 2018 16:00:37 +0000 (16:00 +0000)]
Auto merge of #5828 - kennytm:compile-progress-names, r=alexcrichton

-Zcompile-progress: Use the target name in the progress bar when building a test/binary.

Thus fixes hilarious output like
https://twitter.com/ManishEarth/status/1015479576670027776.

New output: https://asciinema.org/a/F1rkCk0bTWKQMr1NEScia3IYx

6 years agoUse the target name in the progress bar when building a test/binary.
kennytm [Sat, 28 Jul 2018 17:18:47 +0000 (01:18 +0800)]
Use the target name in the progress bar when building a test/binary.

Thus fixes hilarious output like
https://twitter.com/ManishEarth/status/1015479576670027776.

6 years agoDefault target edition to package edition
Dale Wijnand [Fri, 27 Jul 2018 15:59:19 +0000 (16:59 +0100)]
Default target edition to package edition

6 years agofix: Pass `--all-targets` to `cargo fix` by default
Alex Crichton [Thu, 26 Jul 2018 22:21:34 +0000 (15:21 -0700)]
fix: Pass `--all-targets` to `cargo fix` by default

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

Closes #5739

6 years agoWire target edition to rustc/rustdoc
Dale Wijnand [Fri, 27 Jul 2018 14:43:50 +0000 (15:43 +0100)]
Wire target edition to rustc/rustdoc

6 years agoWire Fingerprint to target unit's edition
Dale Wijnand [Fri, 27 Jul 2018 14:37:13 +0000 (15:37 +0100)]
Wire Fingerprint to target unit's edition

6 years agoAdd an Edition on TomlTarget & Target, & wire
Dale Wijnand [Fri, 27 Jul 2018 13:56:48 +0000 (14:56 +0100)]
Add an Edition on TomlTarget & Target, & wire

6 years agoAuto merge of #5812 - dwijnand:move-existing_vcs_repo, r=alexcrichton
bors [Fri, 27 Jul 2018 04:56:29 +0000 (04:56 +0000)]
Auto merge of #5812 - dwijnand:move-existing_vcs_repo, r=alexcrichton

Move existing_vcs_repo to the util::vcs module

Rather than being in cargo_new publically exposed and used by cargo fix.

Just a proposal, as it looked weird to me.

6 years agoAuto merge of #5810 - Eh2406:test-fix, r=alexcrichton
bors [Fri, 27 Jul 2018 03:51:35 +0000 (03:51 +0000)]
Auto merge of #5810 - Eh2406:test-fix, r=alexcrichton

now that we respect gitignore tests can be simplified

There are a lot of test that used a tempfile to avoid the fact that cargo would not init a git in the test folder. (or because they were copy/pasted from one that did.) Now that #5733 landed we can remove them all.

6 years agoAuto merge of #5807 - dwijnand:cargo-list-summary, r=alexcrichton
bors [Fri, 27 Jul 2018 02:49:04 +0000 (02:49 +0000)]
Auto merge of #5807 - dwijnand:cargo-list-summary, r=alexcrichton

Show the command summary when running cargo --list

Fixes #3726

6 years agoAuto merge of #5801 - ehuss:fix-doctestable, r=alexcrichton
bors [Fri, 27 Jul 2018 02:17:52 +0000 (02:17 +0000)]
Auto merge of #5801 - ehuss:fix-doctestable, r=alexcrichton

Fix `test --doc` with incompatible lib types.

When I recently changed the doctest handling, I forgot to check the lib type in
the `test --doc` scenario.

I also added the package name to a nearby error message, since it can be
confusing in a workspace setting.

6 years agoMove existing_vcs_repo to the util::vcs module
Dale Wijnand [Thu, 26 Jul 2018 21:09:45 +0000 (22:09 +0100)]
Move existing_vcs_repo to the util::vcs module

Rather than being in cargo_new publically exposed and used by cargo fix.

6 years agoAvoid right-padding commands with spaces
Dale Wijnand [Thu, 26 Jul 2018 20:42:31 +0000 (21:42 +0100)]
Avoid right-padding commands with spaces

Primarily because it needlessly breaks tests.

6 years agoAdapt --list output in find_closest_biuld_to_build test
Dale Wijnand [Thu, 26 Jul 2018 20:41:43 +0000 (21:41 +0100)]
Adapt --list output in find_closest_biuld_to_build test

6 years agoAuto merge of #5804 - dwijnand:hg-discover, r=alexcrichton
bors [Thu, 26 Jul 2018 19:29:21 +0000 (19:29 +0000)]
Auto merge of #5804 - dwijnand:hg-discover, r=alexcrichton

Fix HgRepo::discover

Replace the duplicate .cwd call with an invocation taken from
https://stackoverflow.com/a/3138925/463761

Match the semantics of the other vcs calls, which is invoke from 'cwd'
targeting 'path'. Looks a little confusing because hg takes a '--cwd'
argument.

6 years agoremove all of the (now) unnecessary temp file usage in tests
Eh2406 [Thu, 26 Jul 2018 19:10:48 +0000 (15:10 -0400)]
remove all of the (now) unnecessary temp file usage in tests

6 years agoupdate test for #5733
Eh2406 [Thu, 26 Jul 2018 18:39:10 +0000 (14:39 -0400)]
update test for #5733

6 years agoAuto merge of #5733 - withoutboats:cargo-new-respects-gitignore, r=alexcrichton
bors [Thu, 26 Jul 2018 18:01:26 +0000 (18:01 +0000)]
Auto merge of #5733 - withoutboats:cargo-new-respects-gitignore, r=alexcrichton

Respect .gitignore during `cargo new`

When running `cargo new`, we check to see if you are inside a git repository. If you are, we do not initialize a new git repo for your project unless you specifically asked for it using --vcs. (See #1210 for more background).

This commit changes that behavior to *also* create a new repo if the project would be an ignored path in the parent repository. This way, if your home directory is a git repository, as long as you have ignored the directory you are creating a new project in, we will instantiate a git repository without you having to specifically request it.

6 years agoAuto merge of #5802 - ehuss:fix-doc-typo, r=dwijnand
bors [Thu, 26 Jul 2018 17:21:33 +0000 (17:21 +0000)]
Auto merge of #5802 - ehuss:fix-doc-typo, r=dwijnand

Fix minor typo in the book.

6 years agoTest verbose error output for a bad lockfile
Dale Wijnand [Thu, 26 Jul 2018 16:14:08 +0000 (17:14 +0100)]
Test verbose error output for a bad lockfile

6 years agoSuggest "update -p" to fix a bad lockfile
Dale Wijnand [Thu, 26 Jul 2018 16:12:09 +0000 (17:12 +0100)]
Suggest "update -p" to fix a bad lockfile

6 years agoRespect .gitignore during `cargo new`
Without Boats [Tue, 17 Jul 2018 06:27:43 +0000 (02:27 -0400)]
Respect .gitignore during `cargo new`

When running `cargo new`, we check to see if you are inside a git
repository. If you are, we do not initialize a new git repo for
your project unless you specifically asked for it using --vcs.
(See #1210 for more background).

This commit changes that behavior to *also* create a new repo if
the project would be an ignored path in the parent repository.
This way, if your home directory is a git repository, as long as
you have ignored the directory you are creating a new project in,
we will instantiate a git repository without you having to
specifically request it.

6 years agoFix read-manifest summary printing under cargo --list
Dale Wijnand [Thu, 26 Jul 2018 11:09:04 +0000 (12:09 +0100)]
Fix read-manifest summary printing under cargo --list