cargo.git
7 years agoCache the query result.
Eh2406 [Fri, 2 Mar 2018 22:56:36 +0000 (17:56 -0500)]
Cache the query result.

In a test on https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286
Before we got to 1700000 ticks in ~97 sec
After we got to 1700000 ticks in ~92 sec
And query disappears from the flame graph

7 years agoAuto merge of #5111 - ehuss:bashc-toolchains, r=alexcrichton
bors [Fri, 2 Mar 2018 20:42:25 +0000 (20:42 +0000)]
Auto merge of #5111 - ehuss:bashc-toolchains, r=alexcrichton

Support +toolchain rustup override in bash completions.

Fixes #5107

7 years agoSupport +toolchain rustup override in bash completions.
Eric Huss [Fri, 2 Mar 2018 19:45:16 +0000 (11:45 -0800)]
Support +toolchain rustup override in bash completions.

Fixes #5107

7 years agoAuto merge of #5095 - tdbgamer:master, r=matklad
bors [Fri, 2 Mar 2018 18:43:11 +0000 (18:43 +0000)]
Auto merge of #5095 - tdbgamer:master, r=matklad

Issue #5087

* remove Workspace::current_manifest
* remove incorrect logging
* move empty check to Packages::into_package_id_specs
* add test case mentioned in issue

7 years agoAuto merge of #5104 - Eh2406:bug_fix, r=alexcrichton
bors [Fri, 2 Mar 2018 15:06:13 +0000 (15:06 +0000)]
Auto merge of #5104 - Eh2406:bug_fix, r=alexcrichton

missed this important bug

In the PR #5000 I finished and we merged yesterday I missed a bug and left in an outdated comment.

@alexcrichton

7 years agoThis test should pass if we have tried to `update registry` evan if the command other...
Eh2406 [Fri, 2 Mar 2018 13:49:42 +0000 (08:49 -0500)]
This test should pass if we have tried to `update registry` evan if the command otherwise fails

7 years agoget ci green; don't clone more than we need
Eh2406 [Fri, 2 Mar 2018 02:44:02 +0000 (21:44 -0500)]
get ci green; don't clone more than we need

7 years agomissed this important bug
Eh2406 [Fri, 2 Mar 2018 02:05:22 +0000 (21:05 -0500)]
missed this important bug

7 years agoMerge remote-tracking branch 'upstream/master'
Timothy Bess [Thu, 1 Mar 2018 22:17:06 +0000 (17:17 -0500)]
Merge remote-tracking branch 'upstream/master'

7 years agoIssue #5087
Timothy Bess [Thu, 1 Mar 2018 22:14:57 +0000 (17:14 -0500)]
Issue #5087
* change match to if

7 years agoAuto merge of #5100 - alexcrichton:better-dep-ordering, r=matklad
bors [Thu, 1 Mar 2018 21:49:10 +0000 (21:49 +0000)]
Auto merge of #5100 - alexcrichton:better-dep-ordering, r=matklad

Improve Cargo's scheduling of builds

Historically Cargo has been pretty naive about scheduling builds, basically just
greedily scheduling as much work as possible. As pointed out in #5014, however,
this isn't guaranteed to always have the best results. If we've got a very deep
dependency tree that would otherwise fill up our CPUs Cargo should ideally
schedule these dependencies first. That way when we reach higher up in the
dependency tree we should have more work available to fill in the cracks if
there's spare cpus.

Closes #5014

7 years agoImprove Cargo's scheduling of builds
Alex Crichton [Thu, 1 Mar 2018 06:04:54 +0000 (22:04 -0800)]
Improve Cargo's scheduling of builds

Historically Cargo has been pretty naive about scheduling builds, basically just
greedily scheduling as much work as possible. As pointed out in #5014, however,
this isn't guaranteed to always have the best results. If we've got a very deep
dependency tree that would otherwise fill up our CPUs Cargo should ideally
schedule these dependencies first. That way when we reach higher up in the
dependency tree we should have more work available to fill in the cracks if
there's spare cpus.

Closes #5014

7 years agoAuto merge of #5000 - Eh2406:i4347, r=alexcrichton
bors [Thu, 1 Mar 2018 21:27:17 +0000 (21:27 +0000)]
Auto merge of #5000 - Eh2406:i4347, r=alexcrichton

backtrack if can not activate

This is a fix for #4347
Unfortunately this too regressed error messages for the case that you specified a dependency feature that does not  exist.
@alexcrichton advice on improving the message?

7 years agoAuto merge of #5103 - alexcrichton:no-hamcrest, r=matklad
bors [Thu, 1 Mar 2018 19:48:18 +0000 (19:48 +0000)]
Auto merge of #5103 - alexcrichton:no-hamcrest, r=matklad

Drop outdated hamcrest dependency

This hasn't been updated in awhile and in general we've been barely using it.
This drops the outdated dependency and vendors a small amount of the
functionality that it provided. I think eventually we'll want to transition away
from this method of assertions but I wanted to get this piece in to avoid too
much churn in one commit.

7 years agoDrop outdated hamcrest dependency
Alex Crichton [Thu, 1 Mar 2018 18:14:17 +0000 (10:14 -0800)]
Drop outdated hamcrest dependency

This hasn't been updated in awhile and in general we've been barely using it.
This drops the outdated dependency and vendors a small amount of the
functionality that it provided. I think eventually we'll want to transition away
from this method of assertions but I wanted to get this piece in to avoid too
much churn in one commit.

7 years agofix cause and the error messages
Eh2406 [Thu, 1 Mar 2018 18:12:27 +0000 (13:12 -0500)]
fix cause and the error messages

7 years agoFold cargotest into testsuite
Alex Crichton [Thu, 1 Mar 2018 17:45:56 +0000 (09:45 -0800)]
Fold cargotest into testsuite

Now that there's only one crate with integration tests there's no need to have
this be a separate crate, yay!

7 years agoOne more todo to fix
Eh2406 [Thu, 1 Mar 2018 16:25:46 +0000 (11:25 -0500)]
One more todo to fix

7 years agofix the todo's
Eh2406 [Tue, 27 Feb 2018 21:42:39 +0000 (16:42 -0500)]
fix the todo's

needs a test where we have an activation_error the then try activate something that dose not work and backtrack to where we had the activation_error then:
- Hit fast backtracking that go past the crate with the missing features
- Or give a bad error message that does not mention the activation_error.
The test will pass, but there is code that is not yet justified by tests

7 years agoWIP: make it recurs if activation fails
Eh2406 [Tue, 27 Feb 2018 16:08:11 +0000 (11:08 -0500)]
WIP: make it recurs if activation fails

7 years agoadd a test for cargo/issues/4347
Eh2406 [Tue, 27 Feb 2018 15:08:19 +0000 (10:08 -0500)]
add a test for cargo/issues/4347

7 years agoAuto merge of #5093 - alexcrichton:include-cargo-lock, r=matklad
bors [Wed, 28 Feb 2018 22:07:53 +0000 (22:07 +0000)]
Auto merge of #5093 - alexcrichton:include-cargo-lock, r=matklad

Package lock files in published crates

Previously we had logic to explicitly skip lock files but there's actually a
good case to read these from crates.io (#2263) so let's do so!

Closes #2263

7 years agoPackage lock files in published crates
Alex Crichton [Tue, 27 Feb 2018 15:56:04 +0000 (07:56 -0800)]
Package lock files in published crates

Previously we had logic to explicitly skip lock files but there's actually a
good case to read these from crates.io (#2263) so let's do so!

Closes #2263

7 years agoIssue #5087
Timothy Bess [Wed, 28 Feb 2018 21:43:08 +0000 (16:43 -0500)]
Issue #5087
* targeted error message for virtual manifests
* assert correct error message

7 years agoRevert "Issue #5087 * fix broken test case"
Timothy Bess [Wed, 28 Feb 2018 21:17:33 +0000 (16:17 -0500)]
Revert "Issue #5087 * fix broken test case"

This reverts commit 17572b8

7 years agoIssue #5087
Timothy Bess [Wed, 28 Feb 2018 21:12:34 +0000 (16:12 -0500)]
Issue #5087
* fix broken test case

7 years agoAuto merge of #5097 - matklad:end-of-tls-saga-hopefully, r=alexcrichton
bors [Wed, 28 Feb 2018 15:20:30 +0000 (15:20 +0000)]
Auto merge of #5097 - matklad:end-of-tls-saga-hopefully, r=alexcrichton

Revert "Warn Windows 7 users about old TLS"

We now have upgraded libgit2 version, so Cargo would use TLS 1.2
on windows unconditionally. Note that even *unpatched* windows 7
supports TLS 1.2.

@retep998, you've originally written that

>TLS 1.2 support for Windows 7 still requires a rather recent patch and so even if we do fix that, we should still keep this error message because some people use Windows 7 with automatic updates disabled.

However, it looks like Windows 7 **does** support TLS 1.2 out of the box, and the update is required to enable the use of TLS 1.2 by default:

https://github.com/libgit2/libgit2/issues/4546#issuecomment-368909158

My own testing on a random win 7 virtual box confirms this.

closes https://github.com/rust-lang/cargo/issues/5066

7 years agoRevert "Warn Windows 7 users about old TLS"
Aleksey Kladov [Wed, 28 Feb 2018 06:39:41 +0000 (09:39 +0300)]
Revert "Warn Windows 7 users about old TLS"

We now have upgraded libgit2 version, so Cargo would use TLS 1.2
on windows unconditionally. Note that even *unpatched* windows 7
supports TLS 1.2

7 years agoIssue #5087
Timothy Bess [Wed, 28 Feb 2018 02:34:04 +0000 (21:34 -0500)]
Issue #5087
* remove Workspace::current_manifest
* remove incorrect logging
* move empty check to Packages::into_package_id_specs
* add test case mentioned in issue

7 years agoRespect lock files in crates.io crates
Alex Crichton [Tue, 27 Feb 2018 15:50:05 +0000 (07:50 -0800)]
Respect lock files in crates.io crates

Currently Cargo doesn't publish lock files in crates.io crates but we'll
eventually be doing so, so this changes Cargo to recognize `Cargo.lock` when
it's published to crates.io as use it as the basis for resolution during `cargo
install`.

cc #2263

7 years agoAuto merge of #5091 - alexcrichton:update-git2, r=matklad
bors [Tue, 27 Feb 2018 14:24:37 +0000 (14:24 +0000)]
Auto merge of #5091 - alexcrichton:update-git2, r=matklad

Update git2 to 0.7.0

cc #5066

7 years agoUpdate git2 to 0.7.0
Alex Crichton [Tue, 27 Feb 2018 13:14:38 +0000 (05:14 -0800)]
Update git2 to 0.7.0

cc #5066

7 years agoAuto merge of #5070 - Eh2406:clippy, r=alexcrichton
bors [Tue, 27 Feb 2018 04:44:41 +0000 (04:44 +0000)]
Auto merge of #5070 - Eh2406:clippy, r=alexcrichton

Some Clippy suggestions

This is just some suggestions from Clippy and intellij rust.

Clippy still has a lot to say, but this is some of the simple things.

7 years agoAuto merge of #5059 - tobywhughes:master, r=alexcrichton
bors [Tue, 27 Feb 2018 04:24:19 +0000 (04:24 +0000)]
Auto merge of #5059 - tobywhughes:master, r=alexcrichton

Clean with --verbose now prints path of what is being removed.

Added verbose output for the clean command. Simply takes whatever is passed into the rm_rf() function and outputs "Removing /whatever/the/path/to/remove/is"

[Issue this is being used for](https://github.com/rust-lang/cargo/issues/5056)

7 years agoone more use of entry
Eh2406 [Tue, 27 Feb 2018 02:46:59 +0000 (21:46 -0500)]
one more use of entry

7 years agosome simple clippy things V2
Eh2406 [Tue, 27 Feb 2018 02:02:39 +0000 (21:02 -0500)]
some simple clippy things V2

7 years agoAuto merge of #5081 - matklad:document-not-all-the-things, r=alexcrichton
bors [Mon, 26 Feb 2018 23:50:53 +0000 (23:50 +0000)]
Auto merge of #5081 - matklad:document-not-all-the-things, r=alexcrichton

Support --exclude option for `cargo doc`

I think this should have been implemented when the feature was added for
other commands. Probably just an oversight.

cc https://github.com/rust-lang/cargo/pull/4031

r? @alexcrichton

7 years agoMerge remote-tracking branch 'upstream/master'
Toby Hughes [Mon, 26 Feb 2018 23:36:23 +0000 (15:36 -0800)]
Merge remote-tracking branch 'upstream/master'

7 years agoAdded tests for clean with verbose output
Toby Hughes [Mon, 26 Feb 2018 23:33:23 +0000 (15:33 -0800)]
Added tests for clean with verbose output

7 years agouse entry to not hash twice thanks clippy
Eh2406 [Sat, 24 Feb 2018 04:06:10 +0000 (23:06 -0500)]
use entry to not hash twice thanks clippy

(cherry picked from commit de9a7b9)

7 years agointellij rust suggested fixes
Eh2406 [Fri, 23 Feb 2018 23:27:53 +0000 (18:27 -0500)]
intellij rust suggested fixes

(cherry picked from commit 24836e9)

7 years agoAuto merge of #5083 - matklad:Cargo-the-tool-1.0, r=alexcrichton
bors [Mon, 26 Feb 2018 22:28:49 +0000 (22:28 +0000)]
Auto merge of #5083 - matklad:Cargo-the-tool-1.0, r=alexcrichton

Make cargo-the-binary version the same as the Rust version

Closes #4211 which seems stuck :-)

Soooo, this is the simplest possible fix to this problem:

```
~/projects/cargo Cargo-the-tool-1.0
λ rustc --version
rustc 1.24.0 (4d90ac38c 2018-02-12)

~/projects/cargo Cargo-the-tool-1.0
λ cargo --version
cargo 0.25.0 (8c93e0895 2018-02-01)
```

It makes `cargo --version` to print the corresponding Rust version (with possibly cargo-specific patch number), while keeping the library version the same as today.

On the one hand, this is horrible. On the other hand, it seems to do the job? In the long term, it would be cool skip one version bump for the library, so that `0.x` corresponds to `1.x`.

cc @rust-lang/cargo

I am not sure that this is good idea, the implementation certainly feels horrible :)

7 years agoAuto merge of #5069 - matklad:win7-y-u-no-tls, r=alexcrichton
bors [Mon, 26 Feb 2018 19:59:27 +0000 (19:59 +0000)]
Auto merge of #5069 - matklad:win7-y-u-no-tls, r=alexcrichton

Warn Windows 7 users about old TLS

An eyepatch for https://github.com/rust-lang/cargo/issues/5066.

@retep998 what would the best way to check for windows 7 specifically? Currently I use just `#[cfg(windows)]`, which might give false positives on 8 and 10.

7 years agoMake cargo-the-binary version the same as the Rust version
Aleksey Kladov [Mon, 26 Feb 2018 19:48:31 +0000 (22:48 +0300)]
Make cargo-the-binary version the same as the Rust version

Closes #4211

7 years agoAuto merge of #5080 - matklad:hope-this-wont-be-re-reverted, r=alexcrichton
bors [Mon, 26 Feb 2018 19:10:55 +0000 (19:10 +0000)]
Auto merge of #5080 - matklad:hope-this-wont-be-re-reverted, r=alexcrichton

Revert "Seperate licenses with a `/`"

This reverts commit 1ddba76a0f5f83884d20be97f49452f9dd1897f1.

OR is the more modern form :rofl:

r? @alexcrichton

7 years agoSupport --exclude option for `cargo doc`
Aleksey Kladov [Mon, 26 Feb 2018 18:39:25 +0000 (21:39 +0300)]
Support --exclude option for `cargo doc`

I think this should have been implemented when the feature was added for
other commands. Probably just an oversight.

7 years agoRevert "Seperate licenses with a `/`"
Aleksey Kladov [Mon, 26 Feb 2018 18:19:26 +0000 (21:19 +0300)]
Revert "Seperate licenses with a `/`"

This reverts commit 1ddba76a0f5f83884d20be97f49452f9dd1897f1.

OR is the more modern form

7 years agoWarn about TLS for github specifically
Aleksey Kladov [Mon, 26 Feb 2018 17:41:22 +0000 (20:41 +0300)]
Warn about TLS for github specifically

7 years agoAuto merge of #5079 - alexcrichton:bump, r=alexcrichton
bors [Mon, 26 Feb 2018 15:55:05 +0000 (15:55 +0000)]
Auto merge of #5079 - alexcrichton:bump, r=alexcrichton

Bump to 0.27.0

7 years agoBump to 0.27.0
Alex Crichton [Mon, 26 Feb 2018 15:35:03 +0000 (07:35 -0800)]
Bump to 0.27.0

7 years agoAuto merge of #5075 - ehuss:report-test-ws, r=matklad
bors [Mon, 26 Feb 2018 15:31:55 +0000 (15:31 +0000)]
Auto merge of #5075 - ehuss:report-test-ws, r=matklad

Fix test error hint in a workspace.

This adds "-p NAME" to the hint on how to re-run a test when it fails if it is
inside a workspace.

Fixes #5053

7 years agoFix test error hint in a workspace.
Eric Huss [Mon, 26 Feb 2018 00:51:48 +0000 (16:51 -0800)]
Fix test error hint in a workspace.

This adds "-p NAME" to the hint on how to re-run a test when it fails if it is
inside a workspace.

Fixes #5053

7 years agoAuto merge of #5074 - CAD97:patch-1, r=alexcrichton
bors [Sun, 25 Feb 2018 12:22:31 +0000 (12:22 +0000)]
Auto merge of #5074 - CAD97:patch-1, r=alexcrichton

Separate licenses with a `/` instead of ` OR `

It's what we tell others to do.

https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata

> ```toml
> # This is a string description of the license for this package. Currently
> # crates.io will validate the license provided against a whitelist of known
> # license identifiers from http://spdx.org/licenses/. Multiple licenses can be
> # separated with a `/`.
> license = "..."
> ```

Noted [here](https://github.com/TeXitoi/structopt/pull/71#discussion_r170423582).

This should either use `/` or a note should be added that ` OR ` is allowed as a combination operator.

7 years agoAuto merge of #5044 - Eh2406:PeekAtRemainingCandidates, r=alexcrichton
bors [Sun, 25 Feb 2018 12:00:24 +0000 (12:00 +0000)]
Auto merge of #5044 - Eh2406:PeekAtRemainingCandidates, r=alexcrichton

make RemainingCandidates::next peekable.

`candidates.next` always came with a `candidates.clone().next(prev_active).is_ok` so let's just make that part of `next`. no `clone` needed.

7 years agoWarn Windows 7 users about old TLS
Aleksey Kladov [Fri, 23 Feb 2018 19:02:00 +0000 (22:02 +0300)]
Warn Windows 7 users about old TLS

An eyepatch for https://github.com/rust-lang/cargo/issues/5066.

7 years agoSeperate licenses with a `/`
Christopher Durham [Sun, 25 Feb 2018 04:48:09 +0000 (23:48 -0500)]
Seperate licenses with a `/`

7 years agoMerge remote-tracking branch 'origin/master' into PeekAtRemainingCandidates
Eh2406 [Sun, 25 Feb 2018 01:23:49 +0000 (20:23 -0500)]
Merge remote-tracking branch 'origin/master' into PeekAtRemainingCandidates

# Conflicts:
# src/cargo/core/resolver/mod.rs

7 years agoonly have one place we push to backtrack_stack
Eh2406 [Sun, 25 Feb 2018 00:39:00 +0000 (19:39 -0500)]
only have one place we push to backtrack_stack

7 years agoformatting
Eh2406 [Sat, 24 Feb 2018 21:26:47 +0000 (16:26 -0500)]
formatting

7 years agoAuto merge of #4978 - Eh2406:master, r=alexcrichton
bors [Sat, 24 Feb 2018 20:46:55 +0000 (20:46 +0000)]
Auto merge of #4978 - Eh2406:master, r=alexcrichton

Only allow one of each links attribute in resolver

This is a start on fixing the `links` part of #4902. It needs code that adds the links attribute to the index. But, I wanted to get feedback.

7 years agoAuto merge of #5061 - ehuss:git-error-auth, r=alexcrichton
bors [Sat, 24 Feb 2018 19:34:52 +0000 (19:34 +0000)]
Auto merge of #5061 - ehuss:git-error-auth, r=alexcrichton

Display git errors during authentication.

Certain git errors during authentication were being converted to internal errors which meant that they are only seen if you pass `--verbose`.  This may not be obvious, and many of these messages are helpful for diagnosing git errors.  This change makes these errors always be displayed.

Fixes #5035.

Note: Some of the git errors are currently unhelpful.  Once Cargo has updated git2-rs to include alexcrichton/git2-rs#298, these errors will improve.  (@alexcrichton, I can make a PR to update Cargo for the changes in git2 if you'd like).

I'm uncertain if this is a good solution, since the error messages in some cases are a little verbose (such as showing `class=...`).  Here is a sample of what some of the messages look like:

<details><summary>Error Message Examples</summary>
<p>
Example of the git message shown below the "attempted yadda yadda" message.

Scenario | Message
---------|--------
No ssh-agent, multiple usernames | `error authenticating: ; class=Ssh (23)`
| | †`error authenticating: no auth sock variable; class=Ssh (23)`
No ssh-agent, one username | `an unknown git error occurred`
| | †`error authenticating: no auth sock variable; class=Ssh (23)`
Incorrect ssh-agent setup | `error authenticating: failed connecting with agent; class=Ssh (23)`
ssh-agent no keys, one username | `an unknown git error occurred`
| | †`failed to acquire username/password from local configuration`
ssh-agent no keys, multiple usernames | `error authenticating: ; class=Ssh (23)`
| | †`no authentication available`
auth success, bad path | `fatal: '/path/to/repo/' does not appear to be a git repository; class=Ssh (23); code=Eof (-20)`
| | ‡`ERROR: Repository not found.; class=Ssh (23); code=Eof (-20)`
bad username | `an unknown git error occurred`
| | †`failed to acquire username/password from local configuration`
| | ‡`error authenticating: Username/PublicKey combination invalid; class=Ssh (23)`

† - Messages once git2-rs is updated.
‡ - Github message

</p>
</details>

7 years agoAuto merge of #5067 - tecywiz121:noting-nothing, r=matklad
bors [Fri, 23 Feb 2018 19:25:53 +0000 (19:25 +0000)]
Auto merge of #5067 - tecywiz121:noting-nothing, r=matklad

Fix a small typo (nothing -> noting)

7 years agoFix a small typo (nothing -> noting)
Sam Wilson [Fri, 23 Feb 2018 15:10:23 +0000 (10:10 -0500)]
Fix a small typo (nothing -> noting)

7 years agoAuto merge of #5064 - Eh2406:fix_test, r=matklad
bors [Thu, 22 Feb 2018 21:49:08 +0000 (21:49 +0000)]
Auto merge of #5064 - Eh2406:fix_test, r=matklad

fix a missing test, this was missed in the rebase of #5063

3 test did not get moved. in #5063.

7 years agofix a missing test, this was missed in the rebase of #5063
Eh2406 [Thu, 22 Feb 2018 16:37:51 +0000 (11:37 -0500)]
fix a missing test, this was missed in the rebase of #5063

7 years agoFix appveyor failure, messages differ by platform.
Eric Huss [Wed, 21 Feb 2018 16:52:24 +0000 (08:52 -0800)]
Fix appveyor failure, messages differ by platform.

7 years agoExpose git errors during authentication.
Eric Huss [Wed, 21 Feb 2018 03:30:00 +0000 (19:30 -0800)]
Expose git errors during authentication.

7 years agoMerge remote-tracking branch 'origin/master' into links
Eh2406 [Wed, 21 Feb 2018 20:41:48 +0000 (15:41 -0500)]
Merge remote-tracking branch 'origin/master' into links

7 years agomake RemainingCandidates::next peekable.
Eh2406 [Thu, 15 Feb 2018 22:36:30 +0000 (17:36 -0500)]
make RemainingCandidates::next peekable.
`candidates.next` always came with a `candidates.clone().next(prev_active).is_ok` so lets just make that part of `next`. no `clone` needed.

7 years agoAuto merge of #5063 - Eh2406:TestssuiteV3, r=matklad
bors [Wed, 21 Feb 2018 19:56:27 +0000 (19:56 +0000)]
Auto merge of #5063 - Eh2406:TestssuiteV3, r=matklad

Reorganize integration tests as one crate with many modules. Issue #4867. Rebased V3

This is an automatic rebase of @rochamatcomp's work in #5022, as requested in [#5038](https://github.com/rust-lang/cargo/pull/5038#issuecomment-365200227).

I take no credit for the changes; I just wanted faster test for my work. :-)

7 years agofix winapi import
Eh2406 [Wed, 21 Feb 2018 19:26:29 +0000 (14:26 -0500)]
fix winapi import

7 years agoAdding cargo.rs file tests as cargo_command.rs.
André Rocha [Thu, 8 Feb 2018 16:30:58 +0000 (17:30 +0100)]
Adding cargo.rs file tests as cargo_command.rs.

7 years agoReorganize integration tests as one crate with many modules. Issue #4867.
André Rocha [Thu, 8 Feb 2018 00:13:17 +0000 (01:13 +0100)]
Reorganize integration tests as one crate with many modules. Issue #4867.

7 years agoClean with --verbose now prints path of what is being removed.
Toby Hughes [Tue, 20 Feb 2018 01:18:38 +0000 (17:18 -0800)]
Clean with --verbose now prints path of what is being removed.

7 years agoAuto merge of #5058 - sfackler:patch-2, r=Mark-Simulacrum
bors [Mon, 19 Feb 2018 22:31:29 +0000 (22:31 +0000)]
Auto merge of #5058 - sfackler:patch-2, r=Mark-Simulacrum

Update default codegen-units

It's been 16 since rustc 1.24.

7 years agoUpdate default codegen-units
Steven Fackler [Mon, 19 Feb 2018 22:29:48 +0000 (14:29 -0800)]
Update default codegen-units

It's been 16 since rustc 1.24.

7 years agoAuto merge of #5051 - cardoe:fix-doc-instructions, r=matklad
bors [Mon, 19 Feb 2018 21:39:17 +0000 (21:39 +0000)]
Auto merge of #5051 - cardoe:fix-doc-instructions, r=matklad

update contributing to show how to build the docs

The contributing guide referenced a script that was deleted in
1271bb4de0c0 so it wasn't possible to follow the contributing guide
successfully prior to contributing doc improvements.

7 years agoAuto merge of #5041 - pwoolcoc:display-path-to-custom-commands-when-verbose, r=matklad
bors [Mon, 19 Feb 2018 21:09:48 +0000 (21:09 +0000)]
Auto merge of #5041 - pwoolcoc:display-path-to-custom-commands-when-verbose, r=matklad

When -v is passed with --list, display path to custom commands

With this change, output of `cargo --list` changes slightly when 1 or more `-v` flags are passed:

```
 ± ./target/debug/cargo --list -v
Installed Commands:
    add                  /path/to/home/.cargo/bin/cargo-add
    bench
    build
    canoe                /path/to/home/.cargo/bin/cargo-canoe
    check
    clean
    do                   /path/to/home/.cargo/bin/cargo-do
    doc
    fetch
    fmt                  /path/to/home/.cargo/bin/cargo-fmt
    ...
```

7 years agoAuto merge of #4953 - alexcrichton:rename-via-as, r=matklad
bors [Mon, 19 Feb 2018 20:21:26 +0000 (20:21 +0000)]
Auto merge of #4953 - alexcrichton:rename-via-as, r=matklad

Implement renaming dependencies in the manifest

This commit implements a new unstable feature for manifests which allows
renaming a crate when depending on it. For example you can do:

```toml
cargo-features = ["dependencies-as"]

...

[dependencies]
foo = "0.1"
bar = { version = "0.1", registry = "custom", package = "foo" }
baz = { git = "https://github.com/foo/bar", package = "foo" }
```

Here three crates will be imported but they'll be made available to the Rust
source code via the names `foo` (crates.io), `bar` (the custom registry), and
`baz` (the git dependency). The *package* name, however, will be `foo` for all
of them. In other words the git repository here would be searched for a crate
called `foo`. For example:

```rust
extern crate foo; // crates.io
extern crate bar; // registry `custom`
extern crate baz; // git repository
```

The intention here is to enable a few use cases:

* Enable depending on the same named crate from different registries
* Allow depending on multiple versions of a crate from one registry
* Removing the need for `extern crate foo as bar` syntactically in Rust source

Currently I don't think we're ready to stabilize this so it's just a nightly
feature, but I'm hoping we can continue to iterate on it!

cc #1311

7 years agoAuto merge of #5050 - cardoe:add-dependency-info, r=matklad
bors [Mon, 19 Feb 2018 19:51:32 +0000 (19:51 +0000)]
Auto merge of #5050 - cardoe:add-dependency-info, r=matklad

doc: add explicit example with ^ and leading 0

Since the leading 0 is treated a bit special, its worth it to have an
explicit example to match the above example of the major version being >
0.

7 years agoupdate contributing to show how to build the docs
Doug Goldstein [Sun, 18 Feb 2018 04:41:32 +0000 (22:41 -0600)]
update contributing to show how to build the docs

The contributing guide referenced a script that was deleted in
1271bb4de0c0 so it wasn't possible to follow the contributing guide
successfully prior to contributing doc improvements.

7 years agodoc: add explicit example with ^ and leading 0
Doug Goldstein [Sun, 18 Feb 2018 04:23:27 +0000 (22:23 -0600)]
doc: add explicit example with ^ and leading 0

Since the leading 0 is treated a bit special, its worth it to have an
explicit example to match the above example of the major version being >
0.

7 years agobetter error messages
Eh2406 [Thu, 15 Feb 2018 03:28:59 +0000 (22:28 -0500)]
better error messages

7 years agoWhen -v is passed with --list, display path to custom commands
Paul Woolcock [Wed, 14 Feb 2018 17:27:19 +0000 (12:27 -0500)]
When -v is passed with --list, display path to custom commands

7 years agoAuto merge of #5037 - Eh2406:conflict_tracking, r=alexcrichton
bors [Wed, 14 Feb 2018 16:52:47 +0000 (16:52 +0000)]
Auto merge of #5037 - Eh2406:conflict_tracking, r=alexcrichton

Conflict tracking

This is an alternative implementation of #4834. This is slower but hopefully more flexible and clearer. The idea is to keep a list of `PackageId`'s that have caused us to skip a `Candidate`. Then we can use the list when we are backtracking if any items in our list have not been activated then we will have new `Candidate`'s to try so we should stop backtracking. Or to say that another way; We can continue backtracking as long as all the items in our list is still activated.

Next this new framework was used to make the error messages more focused. We only need to list the versions that conflict, as opposed to all previously activated versions.

Why is this more flexible?
1. It is not limited to conflicts within the same package. If `RemainingCandidates.next` skips something  because of a links attribute, that is easy to record, just add the `PackageId` to the set `conflicting_prev_active`.
2. Arbitrary things can add conflicts to the backtracking. If we fail to activate because some dependency needs a feature that does not exist, that is easy to record, just add the `PackageId` to the set `conflicting_activations`.
3. All things that could cause use to fail will be in the error messages, as the error messages loop over the set.
4. With a simple extension, replacing the `HashSet` with a `HashMap<_, Reason>`, we can customize the error messages to show the nature of the conflict.

@alexcrichton, @aidanhs, Does the logic look right? Does this seem clearer to you?

7 years agoMerge branch 'conflict_tracking' into links
Eh2406 [Wed, 14 Feb 2018 16:27:48 +0000 (11:27 -0500)]
Merge branch 'conflict_tracking' into links

# Conflicts:
# src/cargo/core/resolver/mod.rs

7 years agoDon't store conflicting_activations for backtracking.
Eh2406 [Wed, 14 Feb 2018 16:22:02 +0000 (11:22 -0500)]
Don't store conflicting_activations for backtracking.
If we need it later we can always add it back in.

7 years agoAuto merge of #5040 - daboross:patch-1, r=alexcrichton
bors [Wed, 14 Feb 2018 15:47:45 +0000 (15:47 +0000)]
Auto merge of #5040 - daboross:patch-1, r=alexcrichton

Remove cargo-only downloads from installation docs

This also copies extra instructions for installing rust from https://doc.rust-lang.org/book/first-edition/getting-started.html#installing-rust-1.

I wasn't able to test the changes locally, but they're fairly minimal, so I trust they will render alright.

Fixes #5027.

7 years agoRemove cargo-only downloads from installation docs
David Ross [Wed, 14 Feb 2018 06:17:15 +0000 (22:17 -0800)]
Remove cargo-only downloads from installation docs

This also copies extra instructions for installing rust from https://doc.rust-lang.org/book/first-edition/getting-started.html#installing-rust-1.

Fixes https://github.com/rust-lang/cargo/issues/5027.

7 years agoAuto merge of #5039 - lawliet89:docopt-bounds, r=alexcrichton
bors [Wed, 14 Feb 2018 06:13:12 +0000 (06:13 +0000)]
Auto merge of #5039 - lawliet89:docopt-bounds, r=alexcrichton

Fix DocOpt deserialization type bounds

This is wrt https://github.com/docopt/docopt.rs/pull/222

DocOpt does not support deserializing borrowed types.

This change was reverted in
https://github.com/docopt/docopt.rs/commit/7292a374e69afb192bb7aaa00f9d9f4afebc200d
because it broke crates like Cargo etc.

7 years agoAdd an explanation of links related conflicts to error messages
Eh2406 [Wed, 14 Feb 2018 04:11:48 +0000 (23:11 -0500)]
Add an explanation of links related conflicts to error messages

7 years agoFix DocOpt deserialization type bounds
Yong Wen Chua [Wed, 14 Feb 2018 01:58:20 +0000 (09:58 +0800)]
Fix DocOpt deserialization type bounds

This is wrt https://github.com/docopt/docopt.rs/pull/222

DocOpt does not support deserializing borrowed types.

This change was reverted in
https://github.com/docopt/docopt.rs/commit/7292a374e69afb192bb7aaa00f9d9f4afebc200d
because it broke crates like Cargo etc.

7 years agoFix a==b and links, and update backtracking
Eh2406 [Tue, 13 Feb 2018 22:56:04 +0000 (17:56 -0500)]
Fix a==b and links, and update backtracking

7 years agoMerge branch 'conflict_tracking' into links
Eh2406 [Tue, 13 Feb 2018 22:16:06 +0000 (17:16 -0500)]
Merge branch 'conflict_tracking' into links

# Conflicts:
# src/cargo/core/resolver/mod.rs
# tests/resolve.rs

7 years agoAuto merge of #5029 - matklad:new-defaults-to-bin, r=withoutboats
bors [Tue, 13 Feb 2018 11:03:57 +0000 (11:03 +0000)]
Auto merge of #5029 - matklad:new-defaults-to-bin, r=withoutboats

New defaults to bin

So this switches `cargo new` default from `--lib` to `--bin`, as discussed on IRC.

The first two commits are just refactorings, and the last one actually flips the switch. Surprisingly enough, no tests need to be modified it seems!

r? @withoutboats

7 years agoUse the conflict tracking in the error messages to only show the versions that are...
Eh2406 [Tue, 13 Feb 2018 01:54:52 +0000 (20:54 -0500)]
Use the conflict tracking in the error messages to only show the versions that are in conflict

7 years agoImplement renaming dependencies in the manifest
Alex Crichton [Wed, 17 Jan 2018 19:33:25 +0000 (11:33 -0800)]
Implement renaming dependencies in the manifest

This commit implements a new unstable feature for manifests which allows
renaming a crate when depending on it. For example you can do:

```toml
cargo-features = ["dependencies-as"]

...

[dependencies]
foo = "0.1"
bar = { version = "0.1", registry = "custom", package = "foo" }
baz = { git = "https://github.com/foo/bar", package = "foo" }
```

Here three crates will be imported but they'll be made available to the Rust
source code via the names `foo` (crates.io), `bar` (the custom registry), and
`baz` (the git dependency). The *package* name, however, will be `foo` for all
of them. In other words the git repository here would be searched for a crate
called `foo`. For example:

```rust
extern crate foo; // crates.io
extern crate bar; // registry `custom`
extern crate baz; // git repository
```

The intention here is to enable a few use cases:

* Enable depending on the same named crate from different registries
* Allow depending on multiple versions of a crate from one registry
* Removing the need for `extern crate foo as bar` syntactically in Rust source

Currently I don't think we're ready to stabilize this so it's just a nightly
feature, but I'm hoping we can continue to iterate on it!

7 years agoAuto merge of #5033 - alexcrichton:update-deps, r=matklad
bors [Mon, 12 Feb 2018 22:32:11 +0000 (22:32 +0000)]
Auto merge of #5033 - alexcrichton:update-deps, r=matklad

Update dependencies

Just a few major updates here and there

7 years agoUpdate dependencies
Alex Crichton [Mon, 12 Feb 2018 20:42:31 +0000 (12:42 -0800)]
Update dependencies

Just a few major updates here and there

7 years agoAuto merge of #5032 - matklad:lazycell, r=alexcrichton
bors [Mon, 12 Feb 2018 22:02:00 +0000 (22:02 +0000)]
Auto merge of #5032 - matklad:lazycell, r=alexcrichton

Switch to lazycell from crate.io

This switches from a home-grown implementation of `lazycell` to the one from crates.io.

There are no particularly large improvements here, but our own lazy cell is definitely unsafe in theory, because of potential reentrancy in `get_or_try_init`, and the one from crates.io does not have at least this hole :-)

Note that `rustc` already has `lazycell` in its Cargo.lock (because of clippy I guess?), albeit with a lower version, 0.5.