Commit graph

3910 commits

Author SHA1 Message Date
Aleksey Kladov
9f7618b36c Preprobe info for known crate type
Previously, we've calculated the set of crate types to learn about by
recursively walking the graph of units. However, to actually know
dependencies of a unit exactly, we must know target specific info, and
we don't know it at this moment (in fact, we are trying calculating it).

Note that crate-type calculation is already lazy, we don't have to calc
all crate-types upfront. So, let's just scrape this info once for
well-known crate types, and fill whatever is left lazily.
2018-03-21 10:54:15 +03:00
Klaus Purer
5907a8bcfa docs(tests): Add comment 2018-03-20 23:05:20 +01:00
Klaus Purer
f2610df06d tests(resolver): Add test for minimum dependency versions 2018-03-20 22:33:10 +01:00
Alex Crichton
0deaae9e52 Don't require cargo update when bumping versions
One historical annoyance I've always had with Cargo that I've found surprising
is that in some situations when you bump version numbers you'll have to end up
running `cargo update` later on to get everything to build. You get pretty wonky
error messages in this case as well saying a package doesn't exist when it
clearly does at a particular location!

I've had difficulty historically nailing down a test case for this but it looks
like we ironically already had one in our test suite and I also jury-rigged up
one from a case I ran into in the wild today.
2018-03-20 12:05:33 -07:00
Lukas Lueg
257c23323d Do not allow crate-type or proc-macro for [[bin]]-targets
in the current workspace.

Fixes #5199.
2018-03-20 16:51:03 +01:00
Aleksey Kladov
deb1c1e15c Fix regression when passing arguments to subcommands 2018-03-20 03:34:37 +03:00
Aleksey Kladov
a1735c7aff Regression tests for #5201
Better safe than sorry!
2018-03-19 23:51:49 +03:00
Ximin Luo
0bc1155753 Split tests, apparently cargo clean does not work well on windows 2018-03-19 18:20:54 +01:00
bors
bdc6fc297c Auto merge of #5187 - Eh2406:faster_resolver, r=alexcrichton
Faster resolver: clean code and the `backtrack_stack`

This is a small extension to #5168 and is inspired by https://github.com/rust-lang/cargo/pull/4834#issuecomment-363518370

After #5168 these work (and don't on cargo from nightly.):
- `safe_core = "=0.22.4"`
- `safe_vault = "=0.13.2"`

But these don't work (and do on cargo from this PR.)
- `crust = "=0.24.0"`
- `elastic = "=0.3.0"`
- `elastic = "=0.4.0"`
- `elastic = "=0.5.0"`
- `safe_vault = "=0.14.0"`

It took some work to figure out why they are not working, and make a test case.

This PR remove use of `conflicting_activations` before it is extended with the conflicting from next.
https://github.com/rust-lang/cargo/pull/5187#issuecomment-373830919
However the `find_candidate(` is still needed so it now gets the conflicting from next before being called.

It often happens that the candidate whose child will fail leading to it's failure, will have older siblings that have already set up `backtrack_frame`s. The candidate knows that it's failure can not be saved by its siblings, but sometimes we activate the child anyway for the error messages. Unfortunately the child does not know that is uncles can't save it, so it backtracks to one of them. Leading to a combinatorial loop.

The solution is to clear the `backtrack_stack` if we are activating just for the error messages.

Edit original end of this message, no longer accurate.
#5168 means that when we find a permanent problem we will never **activate** its parent again. In practise there afften is a lot of work and `backtrack_frame`s between the problem and reactivating its parent. This PR removes `backtrack_frame`s where its parent and the problem are present. This means that when we find a permanent problem we will never **backtrack** into it again.

An alternative is to scan all cashed problems while backtracking, but this seemed more efficient.
2018-03-17 17:49:24 +00:00
Aleksey Kladov
e5971b935c Slightly improve ergonomics of writing Cargo tests 2018-03-17 00:08:23 +03:00
bors
8cc8f3bd0a Auto merge of #5192 - matklad:hash-set-all-the-way-down, r=alexcrichton
Avoid intermediate vector

Just a microoptimization to avoid intermediate `Vec`
2018-03-16 16:06:28 +00:00
Aleksey Kladov
116ecaa635 Avoid intermediate vector 2018-03-16 18:09:44 +03:00
bors
d6c3983fe3 Auto merge of #5196 - matklad:clapclapclap, r=alexcrichton
Fix a regression with parsing multivalue options

By default, clap interprets

```
cargo run --bin foo bar baz
```

as

```
cargo run --bin foo --bin bar --bin baz
```

This behavior is different from docopt and does not play nicely with
positional arguments at all. Luckily, clap has a flag to get the
behavior we want, it just not the default! It will become the default in
the next version of clap, but, until that time, we should be careful
when using the combination of `.long`, `.value_name` and
`.multiple(true)`, and don't forget to specify `.number_of_values(1)` as
well.

@alexcrichton I'd love to merge this fix before updating cargo at rust-lang/rust :)
2018-03-16 15:08:24 +00:00
Aleksey Kladov
70ff33a537 Fix a regression with parsing multivalue options
By default, clap interprets

```
cargo run --bin foo bar baz
```

as

```
cargo run --bin foo --bin bar --bin baz
```

This behavior is different from docopt and does not play nicely with
positional arguments at all. Luckily, clap has a flag to get the
behavior we want, it just not the default! It will become the default in
the next version of clap, but, until that time, we should be careful
when using the combination of `.long`, `.value_name` and
`.multiple(true)`, and don't forget to specify `.number_of_values(1)` as
well.
2018-03-16 17:35:13 +03:00
Aleksey Kladov
81713956f3 Deny warnings in tests 2018-03-16 12:32:31 +03:00
Eh2406
1291c50e86 cargo +stable fmt 2018-03-15 15:02:40 -04:00
Eh2406
617856ec2b add a test 2018-03-15 13:30:42 -04:00
Ximin Luo
0bf8e541db Add tests for --all-targets 2018-03-15 17:08:40 +01:00
Ximin Luo
89d274875f Revert "Work around #5134 for now"
This reverts commit d46db71b3f.
2018-03-15 17:05:13 +01:00
bors
b3df526dc5 Auto merge of #5180 - alexcrichton:transitive-update, r=matklad
Don't abort resolution on transitive updates

This commit is directed at fixing #4127, allowing the resolver to automatically
perform transitive updates when required. A few use casese and tagged links are
hanging off #4127 itself, but the crux of the issue happens when you either add
a dependency or update a version requirement in `Cargo.toml` which conflicts
with something listed in your `Cargo.lock`. In this case Cargo would previously
provide an obscure "cannot resolve" error whereas this commit updates Cargo to
automatically perform a conservative re-resolution of the dependency graph.

It's hoped that this commit will help reduce the number of "unresolvable"
dependency graphs we've seen in the wild and otherwise make Cargo a little more
ergonomic to use as well. More details can be found in the source's comments!

Closes #4127
2018-03-15 15:22:32 +00:00
Alex Crichton
51d235606a Don't abort resolution on transitive updates
This commit is directed at fixing #4127, allowing the resolver to automatically
perform transitive updates when required. A few use casese and tagged links are
hanging off #4127 itself, but the crux of the issue happens when you either add
a dependency or update a version requirement in `Cargo.toml` which conflicts
with something listed in your `Cargo.lock`. In this case Cargo would previously
provide an obscure "cannot resolve" error whereas this commit updates Cargo to
automatically perform a conservative re-resolution of the dependency graph.

It's hoped that this commit will help reduce the number of "unresolvable"
dependency graphs we've seen in the wild and otherwise make Cargo a little more
ergonomic to use as well. More details can be found in the source's comments!

Closes #4127
Closes #5182
2018-03-15 07:44:35 -07:00
Aleksey Kladov
005bd4b4fb Add a helper method to show stdout/err in tests 2018-03-15 10:52:42 +03:00
Aleksey Kladov
b0c181d91c Prettify rustfmted single-line strings 2018-03-14 17:48:44 -07:00
Alex Crichton
1e6828485e cargo fmt 2018-03-14 17:48:23 -07:00
bors
1eb4c8f1b4 Auto merge of #5181 - alexcrichton:selectively-write-dep-info, r=matklad
Don't rewrite dep-info files if they don't change

Similar to how we treat lock files, read the contents, compare, and if they're
the same don't actually write the file.

Closes #5172
2018-03-14 22:17:18 +00:00
bors
83a3084cdd Auto merge of #5179 - matklad:uplink-pdb, r=alexcrichton
Copy `.pdb` files to `target` directory

`.pdb` files are for windows debug info (unlike on linux, debug info is
in a separate file). Windows executable actually hard-code paths to
`.pdb` files, so debugging mvsc rust programs works even without this
patch. However, if you want to distribute the executable to other
machines, you'd better distribute both `foo.exe` and `foo.pdb`, because
absolute paths won't work on another machine. Having same-named .pdb
file alongside the binary would work though.

closes #4960
2018-03-14 21:49:10 +00:00
Aleksey Kladov
f930609404 Don't check for filenames in message-format tests
Depending on the OS, there might be an additional artifacts for
debuginfo (dSYM folder for macs, .pbd file for windows). Given that we
can't disable `.pdb` for windows[1], let's just ignore all filenames!

[1]: https://github.com/rust-lang/rust/pull/28505)
2018-03-15 00:37:26 +03:00
Alex Crichton
f60567666f Don't rewrite dep-info files if they don't change
Similar to how we treat lock files, read the contents, compare, and if they're
the same don't actually write the file.

Closes #5172
2018-03-14 13:27:54 -07:00
Aleksey Kladov
9c0d3f2980 Copy .pdb files to target directory
`.pdb` files are for windows debug info (unlike on linux, debug info is
in a separate file). Windows executable actually hard-code paths to
`.pdb` files, so debugging mvsc rust programs works even without this
patch. However, if you want to distribute the executable to other
machines, you'd better distribute both `foo.exe` and `foo.pdb`, because
absolute paths won't work on another machine. Having same-named .pdb
file alongside the binary would work though.

closes #4960
2018-03-14 22:31:19 +03:00
bors
1891a62d5c Auto merge of #5175 - matklad:conv, r=alexcrichton
Use conventions to specify the integration tests
2018-03-14 18:00:32 +00:00
bors
3a06fde076 Auto merge of #5168 - Eh2406:faster_resolver, r=alexcrichton
Faster resolver: Cache past conflicting_activations, prevent doing the same work repeatedly.

This work is inspired by @alexcrichton's [comment](https://github.com/rust-lang/cargo/issues/4066#issuecomment-303912744) that a slow resolver can be caused by all versions of a dependency being yanked. Witch stuck in my brain as I did not understand why it would happen. If a dependency has no candidates then it will be the most constrained and will trigger backtracking in the next tick. Eventually I found a reproducible test case. If the bad dependency is deep in the tree of dependencies then we activate and backtrack `O(versions^depth)`  times. Even tho it is fast to identify the problem that is a lot of work.

**The set up:**
1. Every time we backtrack cache the (dep, `conflicting_activations`).
2. Build on the work in #5000, Fail to activate if any of its dependencies will just backtrack to this frame. I.E. for each dependency check if any of its cached `conflicting_activations` are already all activated. If so we can just skip to the next candidate. We also add that bad `conflicting_activations` to our set of  `conflicting_activations`, so that we can...

**The pay off:**
 If we fail to find any candidates that we can activate in lite of 2, then we cannot be activated in this context, add our (dep, `conflicting_activations`) to the cache so that next time our parent will not bother trying us.

I hear you saying "but the error messages, what about the error messages?" So if we are at the end `!has_another` then we disable this optimization. After we mark our dep as being not activatable then we activate anyway. It won't resolve but it will have the same error message as before this PR. If we have been activated for the error messages then skip straight to the last candidate, as that is the only backtrack that will end with the user.

I added a test in the vain of #4834. With the old code the time to run was `O(BRANCHING_FACTOR ^ DEPTH)` and took ~3min with DEPTH = 10; BRANCHING_FACTOR = 5; with the new code it runs almost instantly with 200 and 100.
2018-03-14 16:19:30 +00:00
Aleksey Kladov
cbd14ee8f0 Use conventions to specify the integration tests 2018-03-14 14:55:19 +03:00
Eh2406
d903259423 test that cashing works with constraints correctly 2018-03-13 11:16:10 -04:00
bors
3cfb23bc56 Auto merge of #5152 - matklad:clap, r=alexcrichton
Clap

Reopening of #5129

So, looks like all tests are 🍏 on my machine!

I definitely want to refactor it some more, and also manually checked that we haven't regressed any help messages, but all the major parts are in place already.
2018-03-13 14:46:45 +00:00
Eh2406
61e78c10f1 make sure cashing works whether there is an answer or not 2018-03-12 17:36:02 -04:00
Aleksey Kladov
74f4089387 Fix spelling of quiet 2018-03-12 23:08:49 +03:00
Eh2406
5ae3468d74 if we are just here_for the error_messages then only try the last candidate 2018-03-11 22:21:38 -04:00
Eh2406
d8cb25e5ba cache past conflicting_activations use them to prevent doing the same work repeatedly 2018-03-11 22:21:37 -04:00
Eh2406
7515d2d9c8 this test is slow because it runs the same searches repeatedly 2018-03-11 22:21:37 -04:00
Aleksey Kladov
a64df78ea6 Relax tests for windows
On windows, clap prints `cargo.exe` rather than just `cargo`.
2018-03-10 18:46:32 +03:00
Tatsuyuki Ishi
db58fd709a
Remove unused import 2018-03-10 15:21:25 +09:00
bors
d147e10374 Auto merge of #5126 - gilescope:cycle-error-message, r=alexcrichton
Error message for package "depends on itself" lists the packages in the cycle.

I got a cycle while trying to build someone else's code and cargo's error message didn't point me in the right direction, just mentioned there was a cycle. I thought we could be a bit more helpful.

Don't know what you think of {:#?} as the display but it seemed minimal code so I thought I'd start with that. I could compress the output to one package per line if preferred.
2018-03-09 19:40:03 +00:00
Aleksey Kladov
67968e6b0e Validate that jobs argument is a number 2018-03-09 11:05:47 +03:00
Aleksey Kladov
16bde4e0ae Unwind stack for cli errors 2018-03-09 10:43:00 +03:00
Aleksey Kladov
cc3ce0007d Fix --explain 2018-03-08 23:31:56 +03:00
Aleksey Kladov
0470d77575 Support list subcommand
All tests are green 🎉
2018-03-08 23:31:56 +03:00
Aleksey Kladov
93875b88da Support aliases 2018-03-08 23:31:56 +03:00
Aleksey Kladov
6783272a82 Fix more tests by updating error messages 2018-03-08 23:31:56 +03:00
Aleksey Kladov
89c6d7761f Unignore test which now passes 2018-03-08 23:31:56 +03:00
Aleksey Kladov
af88c9f203 Disable cargo help -h 2018-03-08 23:31:56 +03:00
Aleksey Kladov
63d4e5c8b2 Fix verify-project command 2018-03-08 23:31:56 +03:00
Aleksey Kladov
35365a6f39 Support built-in aliases 2018-03-08 23:31:56 +03:00
Aleksey Kladov
81ce3e1bef Support external subcommands 2018-03-08 23:31:56 +03:00
Aleksey Kladov
4d3ca92150 Use exit code 1 for command line parsing errors
Note that while we use 101 in majority of cases, sometimes we use 1 as
well.
2018-03-08 23:31:56 +03:00
Aleksey Kladov
31ea0d93f7 Fix some trivially fixable tests 2018-03-08 23:31:56 +03:00
Aleksey Kladov
c327245ca5 Drop old commands 2018-03-08 23:31:56 +03:00
Aleksey Kladov
666e232b59 Move the rest of the commands to clap 2018-03-08 23:30:47 +03:00
Aleksey Kladov
444101a6b3 Move search to clap 2018-03-08 23:30:47 +03:00
Aleksey Kladov
8e8e924e3f Move rustc to clap 2018-03-08 23:30:47 +03:00
Aleksey Kladov
7bf1619c01 Move run to clap 2018-03-08 23:30:47 +03:00
Aleksey Kladov
062a6e7a08 Move new to clap 2018-03-08 23:30:46 +03:00
Aleksey Kladov
6022d022ab Move metadata to clap 2018-03-08 23:30:46 +03:00
Aleksey Kladov
57789d7ddc Move install to clap 2018-03-08 23:30:46 +03:00
Aleksey Kladov
4131bdbe72 Move init to clap 2018-03-08 23:30:46 +03:00
Aleksey Kladov
0ac7251831 Move check to clap 2018-03-08 23:30:46 +03:00
Aleksey Kladov
178b16d12b Temporarly ignore some tests 2018-03-08 23:30:46 +03:00
Giles Cope
74deb8c96d Switch to exhaustive matches in tests. 2018-03-08 18:37:30 +00:00
Giles Cope
32c7ac144b As pointed out by Jacob, we can display the ordered cycle in the error message. 2018-03-07 22:56:47 +00:00
bors
879f48324d Auto merge of #5012 - infinity0:pr4988, r=alexcrichton
Don't require dev-dependencies when not needed in certain cases

Specifically, when running `cargo install` and add a flag for this behaviour in `cargo build`.

This closes #4988.
2018-03-07 15:39:24 +00:00
Ximin Luo
d46db71b3f Work around #5134 for now 2018-03-07 14:46:43 +01:00
bors
dd4f46e7dd Auto merge of #5135 - matklad:drop-ignored-tests, r=alexcrichton
Drop ignored tests

r? @alexcrichton

These tests are ignored, so its better to remove them. `run` does not supports `--bins` argument, so I've left a single test that checks specifically for this.

cc https://github.com/rust-lang/cargo/pull/3901
2018-03-06 22:34:32 +00:00
Aleksey Kladov
96a4aa836e Drop ignored tests 2018-03-06 23:28:52 +03:00
Ximin Luo
31f6f84eff Merge remote-tracking branch 'upstream/master' into pr4988 2018-03-06 19:56:35 +01:00
Giles Cope
3cd7708774 Neater error message. Tests now check the cycle is output. 2018-03-06 09:30:37 +00:00
Giles Cope
2ee2741e80 Error message for package cycles lists the packages in the cycle. 2018-03-06 00:41:21 +00:00
Alex McArther
6a2b6468ca Repair the other metadata tests 2018-03-05 06:36:12 -08:00
Alex McArther
3904562fe7 Emit resolve.features in "cargo metadata" 2018-03-04 22:04:27 -08:00
Alex Crichton
d6d1f3ab7d Update a test to not clone the real index
A local index should work ok!
2018-03-04 12:51:31 -08:00
Ximin Luo
9c5eecd419 Merge remote-tracking branch 'upstream/master' into pr4988 2018-03-03 12:56:08 +01:00
bors
4429f4efa1 Auto merge of #5110 - alexcrichton:reset-harder, r=matklad
Try a lot harder to recover corrupt git repos

We've received a lot of intermittent bug reports historically about corrupt git
repositories. These inevitably happens as Cargo is ctrl-c'd or for whatever
other reason, and to provide a better user experience Cargo strives to
automatically handle these situations by blowing away the old checkout for a new
update.

This commit adds a new test which attempts to pathologically corrupt a git
database and checkout in an attempt to expose bugs in Cargo. Sure enough there
were some more locations that we needed to handle gracefully for corrupt git
checkouts. Notable inclusions were:

* The `fetch` operation in libgit2 would fail due to corrupt references. This
  starts by adding an explicit whitelist for classes of errors coming out of
  `fetch` to auto-retry by blowing away the repository. We need to be super
  careful here as network errors commonly come out of this function and we don't
  want to too aggressively re-clone.

* After a `fetch` succeeded a repository could fail to actual resolve a
  git reference to the actual revision we want. This indicated that we indeed
  needed to blow everything away and re-clone entirely again.

* When creating a checkout from a database the `reset` operation might fail due
  to a corrupt local database of the checkout itself. If this happens we needed
  to just blow it away and try again.

There's likely more lurking situations where we need to re-clone but I figure we
can discover those over time.
2018-03-02 23:37:29 +00:00
Alex Crichton
c933673e7d Try a lot harder to recover corrupt git repos
We've received a lot of intermittent bug reports historically about corrupt git
repositories. These inevitably happens as Cargo is ctrl-c'd or for whatever
other reason, and to provide a better user experience Cargo strives to
automatically handle these situations by blowing away the old checkout for a new
update.

This commit adds a new test which attempts to pathologically corrupt a git
database and checkout in an attempt to expose bugs in Cargo. Sure enough there
were some more locations that we needed to handle gracefully for corrupt git
checkouts. Notable inclusions were:

* The `fetch` operation in libgit2 would fail due to corrupt references. This
  starts by adding an explicit whitelist for classes of errors coming out of
  `fetch` to auto-retry by blowing away the repository. We need to be super
  careful here as network errors commonly come out of this function and we don't
  want to too aggressively re-clone.

* After a `fetch` succeeded a repository could fail to actual resolve a
  git reference to the actual revision we want. This indicated that we indeed
  needed to blow everything away and re-clone entirely again.

* When creating a checkout from a database the `reset` operation might fail due
  to a corrupt local database of the checkout itself. If this happens we needed
  to just blow it away and try again.

There's likely more lurking situations where we need to re-clone but I figure we
can discover those over time.
2018-03-02 15:32:24 -08:00
bors
078f333f10 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
2018-03-02 18:43:11 +00:00
Eh2406
d9c97debbb This test should pass if we have tried to update registry evan if the command otherwise fails 2018-03-02 08:49:42 -05:00
Timothy Bess
891d673764 Merge remote-tracking branch 'upstream/master' 2018-03-01 17:17:06 -05:00
bors
382967ad10 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?
2018-03-01 21:27:17 +00:00
Alex Crichton
2a063798eb 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.
2018-03-01 11:03:54 -08:00
Eh2406
2cbd1ddc93 fix cause and the error messages 2018-03-01 13:24:26 -05:00
Alex Crichton
de70bc01db 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!
2018-03-01 09:45:56 -08:00
Eh2406
5d4402ce17 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
2018-03-01 06:34:17 -05:00
Eh2406
834846901d add a test for cargo/issues/4347 2018-02-28 23:40:45 -05:00
Alex Crichton
a4a3302d46 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
2018-02-28 13:57:16 -08:00
Timothy Bess
05b896ac90 Issue #5087
* targeted error message for virtual manifests
* assert correct error message
2018-02-28 16:43:08 -05:00
Timothy Bess
7334fe42b8 Revert "Issue #5087 * fix broken test case"
This reverts commit 17572b8
2018-02-28 16:17:33 -05:00
Timothy Bess
17572b8c91 Issue #5087
* fix broken test case
2018-02-28 16:12:34 -05:00
Timothy Bess
68a681ff03 Issue #5087
* remove Workspace::current_manifest
* remove incorrect logging
* move empty check to Packages::into_package_id_specs
* add test case mentioned in issue
2018-02-27 21:37:40 -05:00
Alex Crichton
8b475c1085 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
2018-02-27 07:50:58 -08:00
Alex Crichton
a85c917b6b Update git2 to 0.7.0
cc #5066
2018-02-27 06:24:26 -08:00
bors
3361918384 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.
2018-02-27 04:44:41 +00:00
Toby Hughes
0661b3fbb5 Merge remote-tracking branch 'upstream/master' 2018-02-26 15:36:23 -08:00
Eh2406
0247dc429a intellij rust suggested fixes
(cherry picked from commit 24836e9)
2018-02-26 17:29:17 -05:00
Eric Huss
c61efd8c39 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
2018-02-25 16:51:48 -08:00
bors
fe0c18b9db 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.
2018-02-24 20:46:55 +00:00
bors
f75f403ed1 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>
2018-02-24 19:34:52 +00:00
Eh2406
97249ec060 fix a missing test, this was missed in the rebase of #5063 2018-02-22 11:37:51 -05:00
Eric Huss
f66fe2c650 Fix appveyor failure, messages differ by platform. 2018-02-21 14:33:20 -08:00
Eric Huss
4c0b239c1f Expose git errors during authentication. 2018-02-21 14:29:33 -08:00
Eh2406
68a40ad42b Merge remote-tracking branch 'origin/master' into links 2018-02-21 15:41:48 -05:00
Eh2406
7a564576f1 fix winapi import 2018-02-21 14:26:29 -05:00
André Rocha
98f17bcc56 Adding cargo.rs file tests as cargo_command.rs. 2018-02-21 13:33:52 -05:00
André Rocha
c2ff988c9f Reorganize integration tests as one crate with many modules. Issue #4867. 2018-02-21 13:33:51 -05:00