]> git.proxmox.com Git - cargo.git/log
cargo.git
6 years agoAuto merge of #5249 - alexcrichton:run-rustc-less, r=matklad
bors [Tue, 27 Mar 2018 13:58:26 +0000 (13:58 +0000)]
Auto merge of #5249 - alexcrichton:run-rustc-less, r=matklad

Run `rustc` for information fewer times

Currently if you pass `--target` the same as rustc's host Cargo will run `rustc`
on extra time to learn information, but we only need to run it once to learn
such information!

6 years agoRun `rustc` for information fewer times
Alex Crichton [Tue, 27 Mar 2018 11:55:23 +0000 (04:55 -0700)]
Run `rustc` for information fewer times

Currently if you pass `--target` the same as rustc's host Cargo will run `rustc`
on extra time to learn information, but we only need to run it once to learn
such information!

6 years agoAuto merge of #5250 - rleungx:tweak-error-message, r=matklad
bors [Tue, 27 Mar 2018 13:16:48 +0000 (13:16 +0000)]
Auto merge of #5250 - rleungx:tweak-error-message, r=matklad

tweak error message

Closes #5238.

6 years agoaddress comment
rleungx [Tue, 27 Mar 2018 12:54:18 +0000 (20:54 +0800)]
address comment

6 years agotweak error message
rleungx [Tue, 27 Mar 2018 12:34:18 +0000 (20:34 +0800)]
tweak error message

6 years agoAuto merge of #5205 - gibix:i2773, r=alexcrichton
bors [Tue, 27 Mar 2018 12:19:45 +0000 (12:19 +0000)]
Auto merge of #5205 - gibix:i2773, r=alexcrichton

fix #2773 with new precise encode

Changed the precise encode from <pkg>=<precise> to <pkg>=<present_version>-><future_version> in order to check the correct requirements.

cc @lu-zero

6 years agoAuto merge of #5228 - phil-opp:target-spec, r=alexcrichton
bors [Mon, 26 Mar 2018 13:00:26 +0000 (13:00 +0000)]
Auto merge of #5228 - phil-opp:target-spec, r=alexcrichton

Add support for absolute target.json paths

Builds upon https://github.com/rust-lang/rust/pull/49019 with the goal to provide a solution to https://github.com/rust-lang/cargo/issues/4905.

This PR does two things:

~~1. It appends a hash of the target path to the target folder name if a `*.json` path is passed as `--target`, like it's done in https://github.com/rust-lang/rust/pull/49019. This helps differentiating targets with the same JSON file name and avoids sysroot clashes in `xargo`.~~ See https://github.com/rust-lang/cargo/pull/5228#discussion_r176827531
2. It canonicalizes the passed target path (if it's a `*.json` path), so that the path stays valid when building dependencies and setting the `RUST_TARGET_PATH` environment variable is no longer necessary.

6 years agoAuto merge of #5244 - Eijebong:tempfile, r=alexcrichton
bors [Mon, 26 Mar 2018 12:37:09 +0000 (12:37 +0000)]
Auto merge of #5244 - Eijebong:tempfile, r=alexcrichton

Replace tempdir by tempfile

The former has been deprecated in favor of the latter

6 years agoReplace tempdir by tempfile
Bastien Orivel [Mon, 26 Mar 2018 10:42:30 +0000 (12:42 +0200)]
Replace tempdir by tempfile

The former has been deprecated in favor of the latter

6 years agoAuto merge of #5243 - alexcrichton:more-feature-sync, r=alexcrichton
bors [Mon, 26 Mar 2018 06:53:49 +0000 (06:53 +0000)]
Auto merge of #5243 - alexcrichton:more-feature-sync, r=alexcrichton

More effort to only compile Cargo once

Hopefully one final change necessary for rust-lang/rust#49053

6 years agoMore effort to only compile Cargo once
Alex Crichton [Mon, 26 Mar 2018 06:52:55 +0000 (23:52 -0700)]
More effort to only compile Cargo once

Hopefully one final change necessary for rust-lang/rust#49053

6 years agoAdd custom target tests
Philipp Oppermann [Sat, 24 Mar 2018 20:38:48 +0000 (21:38 +0100)]
Add custom target tests

6 years agoCanonicalize paths passed as `--target`
Philipp Oppermann [Thu, 22 Mar 2018 17:53:19 +0000 (18:53 +0100)]
Canonicalize paths passed as `--target`

6 years agoAuto merge of #5232 - matklad:unit-map, r=alexcrichton
bors [Sun, 25 Mar 2018 07:25:30 +0000 (07:25 +0000)]
Auto merge of #5232 - matklad:unit-map, r=alexcrichton

Refactor context to extract dependencies calculation to a separate mod

This makes unit dependency graph construction eager and moves it to a separate file.

Hopefully, this makes `Context` slightly easier to understand :)

6 years agoRefactor context to extract dependencies calculation to a separate mod
Aleksey Kladov [Fri, 23 Mar 2018 11:51:32 +0000 (14:51 +0300)]
Refactor context to extract dependencies calculation to a separate mod

6 years agoAuto merge of #5239 - alexcrichton:remove-scoped-tls, r=matklad
bors [Sat, 24 Mar 2018 19:54:49 +0000 (19:54 +0000)]
Auto merge of #5239 - alexcrichton:remove-scoped-tls, r=matklad

Remove scoped_tls dependency

This is causing [conflicts] with rebuilding upstream in rust-lang/rust, so
remove this for now until we figure out a better solution.

[conflicts]: https://github.com/rust-lang/rust/pull/49053#issuecomment-375906970

6 years agoRemove scoped_tls dependency
Alex Crichton [Sat, 24 Mar 2018 16:51:33 +0000 (09:51 -0700)]
Remove scoped_tls dependency

This is causing [conflicts] with rebuilding upstream in rust-lang/rust, so
remove this for now until we figure out a better solution.

[conflicts]: https://github.com/rust-lang/rust/pull/49053#issuecomment-375906970

6 years agoadd precise test
gibix [Sat, 24 Mar 2018 19:04:19 +0000 (20:04 +0100)]
add precise test

6 years agocargo fmt
gibix [Sat, 24 Mar 2018 19:04:02 +0000 (20:04 +0100)]
cargo fmt

6 years agofix typo , drop return and intermediate vector
gibix [Tue, 20 Mar 2018 10:02:29 +0000 (11:02 +0100)]
fix typo , drop return and intermediate vector

6 years agocargo fmt
gibix [Tue, 20 Mar 2018 08:58:51 +0000 (09:58 +0100)]
cargo fmt

6 years agofix #2773 with new precise encode
gibix [Mon, 19 Mar 2018 17:43:02 +0000 (18:43 +0100)]
fix #2773 with new precise encode

6 years agoAuto merge of #5213 - Eh2406:faster_resolver, r=alexcrichton
bors [Sat, 24 Mar 2018 16:59:59 +0000 (16:59 +0000)]
Auto merge of #5213 - Eh2406:faster_resolver, r=alexcrichton

Faster resolver: use a inverse-index to not activate the causes of conflict

This adds a test for https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286 with two extensions that make it harder. It is the last reproducible and in the wild exponentially slow resolution (that I have found).

The problem in the test is `backtrack_trap0 = "*"` is a lot of ways of saying `constrained = ">=1.1.0, <=2.0.0"` but `constrained= "2.0.1"` is already picked. Only then to try and solve `constrained= "~1.0.0"` which is incompatible. Our parent knows that we have been poisoned, and wont try to activate us again.  Because of the order we evaluate deps we end up backtracking to where `constrained: 1.1.0` is set instead of our parent. And so the poisoning does not help. This is harder then https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286 because:

1. Having multiple semver compatible versions of constrained in play makes for a lot more bookkeeping. Specifically bookkeeping I forgot when I first submitted this PR.
2. The problematic dependencies are added deep in a combinatorial explosion of possibilities. So if we don't correctly handle caching that `backtrack_trap0 = "*"` is doomed then we will never finish looking thru the different possibilities for `level0 = "*"`

This PR also includes a proof of concept solution for the test, which proves that it does solve https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286. The added code is tricky to read. It also adds a `O(remaining_deps)` job to every activation on the happy path, slower if the `past_conflicting_activations` is not empty.

I'd like some brainstorming on better solutions.

6 years agoaddress suggestions
Eh2406 [Fri, 23 Mar 2018 20:40:51 +0000 (16:40 -0400)]
address suggestions

6 years agoMove caching to a support struct and file
Eh2406 [Fri, 23 Mar 2018 15:39:12 +0000 (11:39 -0400)]
Move caching to a support struct and file

6 years agoadd comments
Eh2406 [Thu, 22 Mar 2018 21:33:56 +0000 (17:33 -0400)]
add comments

6 years agoremove some loops
Eh2406 [Thu, 22 Mar 2018 20:18:58 +0000 (16:18 -0400)]
remove some loops

6 years agotest the new backtracking does all of its bookkeeping
Eh2406 [Wed, 21 Mar 2018 21:05:55 +0000 (17:05 -0400)]
test the new backtracking does all of its bookkeeping

6 years agomaintain an inverse-index
Eh2406 [Wed, 21 Mar 2018 17:09:08 +0000 (13:09 -0400)]
maintain an inverse-index

6 years agoproblematic extension and solution
Eh2406 [Sun, 18 Mar 2018 03:05:08 +0000 (23:05 -0400)]
problematic extension and solution

6 years agoA slow and ugly solution, but it works.
Eh2406 [Sun, 18 Mar 2018 02:44:30 +0000 (22:44 -0400)]
A slow and ugly solution, but it works.

6 years agoAdd a test for https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286
Eh2406 [Sun, 18 Mar 2018 02:31:04 +0000 (22:31 -0400)]
Add a test for https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286

6 years agoAuto merge of #5200 - klausi:minimal_versions, r=Eh2406
bors [Fri, 23 Mar 2018 19:20:10 +0000 (19:20 +0000)]
Auto merge of #5200 - klausi:minimal_versions, r=Eh2406

feat(resolver): Add CLI option to resolve minimal version dependencies

Fixes #4100

Test cases are still missing. We need to come up with a plan what cases we want to cover.

Thanks a lot to @Eh2406 for very helpful instructions to kick this off.

6 years agotests(resolver): Group integration test with other minimal version test
Klaus Purer [Fri, 23 Mar 2018 19:06:49 +0000 (20:06 +0100)]
tests(resolver): Group integration test with other minimal version test

6 years agotests(resolver): Add integration test for -Z minimal-versions
Klaus Purer [Fri, 23 Mar 2018 18:58:56 +0000 (19:58 +0100)]
tests(resolver): Add integration test for -Z minimal-versions

6 years agofix(resolver): Preserve lock file when sorting for minimal versions, document tests
Klaus Purer [Fri, 23 Mar 2018 17:28:51 +0000 (18:28 +0100)]
fix(resolver): Preserve lock file when sorting for minimal versions, document tests

6 years agoAuto merge of #5233 - lukaslueg:issue5229, r=matklad
bors [Fri, 23 Mar 2018 15:28:44 +0000 (15:28 +0000)]
Auto merge of #5233 - lukaslueg:issue5229, r=matklad

Assert Dependency::name is never empty, prevent 'install ""' from crashing

An explicit `cargo install ""` would cause clap to pass an empty crate-name,
leading to a panic(). We now assert() that Dependency::name is never the
empty string and prevent the situation in the first place by not allowing
the crate-name to be empty for `install`.

Fixes #5229

6 years agoAssert that Dependency::name is never empty, prevent 'install ""' from crashing
Lukas Lueg [Fri, 23 Mar 2018 14:26:50 +0000 (15:26 +0100)]
Assert that Dependency::name is never empty, prevent 'install ""' from crashing

An explicit `cargo install ""` would cause clap to pass an empty crate-name,
leading to a panic(). We now assert() that Dependency::name is never the
empty string and prevent the situation in the first place by not allowing
the crate-name to be empty for `install`.

Fixes #5229

6 years agoAuto merge of #5231 - matklad:simplify, r=alexcrichton
bors [Fri, 23 Mar 2018 14:33:49 +0000 (14:33 +0000)]
Auto merge of #5231 - matklad:simplify, r=alexcrichton

Simplify `build_map`

This doesn't change semantics, but helps us not to rebuild BuildScripts
twice, and makes sure that we fail with assert if somehow we get cyclic
deps.

r? @alexcrichton

6 years agoSimplify `build_map`
Aleksey Kladov [Fri, 23 Mar 2018 09:20:01 +0000 (12:20 +0300)]
Simplify `build_map`

This doesn't change semantics, but helps us not to rebuild BuildScripts
twice, and makes sure that we fail with assert if somehow we get cyclic
deps

6 years agoAuto merge of #5230 - matthiaskrgr:newline, r=alexcrichton
bors [Fri, 23 Mar 2018 02:25:08 +0000 (02:25 +0000)]
Auto merge of #5230 - matthiaskrgr:newline, r=alexcrichton

add final linebreak to cargo default help message.

before:
![cargo_before](https://user-images.githubusercontent.com/476013/37807125-16809ec8-2e44-11e8-9606-f37c1a97caf2.png)
patch:
![cargo_after](https://user-images.githubusercontent.com/476013/37807134-227b658c-2e44-11e8-8f4b-d430414e69dc.png)

I assume this is some kind of leftover from the clap transition. cc @matklad

6 years agoadd final linebreak to cargo default help message.
Matthias Krüger [Fri, 23 Mar 2018 01:33:50 +0000 (02:33 +0100)]
add final linebreak to cargo default help message.

6 years agoAuto merge of #5226 - jeehoonkang:doc-caret, r=alexcrichton
bors [Thu, 22 Mar 2018 18:48:48 +0000 (18:48 +0000)]
Auto merge of #5226 - jeehoonkang:doc-caret, r=alexcrichton

doc: Clarify the meaning of caret requirements

Closes #4910 (which is already closed, though 😄)

r? @alexcrichton

6 years agodoc: Clarify the meaning of caret requirements
Jeehoon Kang [Thu, 22 Mar 2018 18:25:28 +0000 (03:25 +0900)]
doc: Clarify the meaning of caret requirements

Closes #4910

6 years agoAuto merge of #5225 - matthiaskrgr:revert_pr5223, r=alexcrichton
bors [Thu, 22 Mar 2018 16:32:43 +0000 (16:32 +0000)]
Auto merge of #5225 - matthiaskrgr:revert_pr5223, r=alexcrichton

Revert "manifest: update default lto for release and bench to 'thin'."

This reverts commit e74ff4db13f2ae00245902cb5b496b3b39128653.

Turns out I was wrong, sorry for the noise.

6 years agoRevert "manifest: update default lto for release and bench to 'thin'."
Matthias Krüger [Thu, 22 Mar 2018 15:26:13 +0000 (16:26 +0100)]
Revert "manifest: update default lto for release and bench to 'thin'."

This reverts commit e74ff4db13f2ae00245902cb5b496b3b39128653.

Turns out I was wrong, sorry for the noise.

6 years agoAuto merge of #5217 - matklad:known-crate-types, r=alexcrichton
bors [Thu, 22 Mar 2018 14:07:49 +0000 (14:07 +0000)]
Auto merge of #5217 - matklad:known-crate-types, r=alexcrichton

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.

@alexcrichton would this approach work at all? I think it would, if `KNOWN_CRATE_TYPES` are all available for all target-tripples we support. Is it a valid assumption?

The larger picture is that I am trying to make unit dependency resolution eager and move it into the separate file. I even got something working, but I have to run dependency resolution three times, because it is not exactly idempotent for various reasons, including this target-info stuff :)

```
    cx.prepare()?;
    cx.build_unit_map(units.clone())?; // resolve dependencies
    cx.probe_target_info(&units)?;
    cx.build_unit_map(units.clone())?; // resolve again
    cx.build_used_in_plugin_map(&units)?;
    custom_build::build_map(&mut cx, &units)?;
    cx.build_unit_map(units.clone())?; // and resolve one final time :)
```

6 years agoAuto merge of #5223 - matthiaskrgr:manifest_update, r=matklad
bors [Thu, 22 Mar 2018 11:50:27 +0000 (11:50 +0000)]
Auto merge of #5223 - matthiaskrgr:manifest_update, r=matklad

manifest: update default lto for release and bench to "thin"

[redacted]

6 years agomanifest: update default lto for release and bench to 'thin'.
Matthias Krüger [Thu, 22 Mar 2018 11:36:37 +0000 (12:36 +0100)]
manifest: update default lto for release and bench to 'thin'.

6 years agoAuto merge of #5222 - AdamNiederer:patch-1, r=matklad
bors [Thu, 22 Mar 2018 09:01:37 +0000 (09:01 +0000)]
Auto merge of #5222 - AdamNiederer:patch-1, r=matklad

Add docstrings to CleanOptions

6 years agoAdd docstrings to CleanOptions
Adam Niederer [Thu, 22 Mar 2018 02:13:05 +0000 (22:13 -0400)]
Add docstrings to CleanOptions

6 years agoAuto merge of #5219 - mbrubeck:doc, r=alexcrichton
bors [Wed, 21 Mar 2018 18:48:39 +0000 (18:48 +0000)]
Auto merge of #5219 - mbrubeck:doc, r=alexcrichton

Fix usage text for cargo install

The current text was accidentally copied from `cargo init`.

6 years agoFix usage text for cargo install
Matt Brubeck [Wed, 21 Mar 2018 16:26:51 +0000 (09:26 -0700)]
Fix usage text for cargo install

The current text was accidentally copied from `cargo init`.

6 years agoAuto merge of #5186 - infinity0:stricter-need-dev-deps, r=alexcrichton
bors [Wed, 21 Mar 2018 14:19:11 +0000 (14:19 +0000)]
Auto merge of #5186 - infinity0:stricter-need-dev-deps, r=alexcrichton

Stricter need_dev_deps behaviour

The previous PR (#5012) contained an unnecessary work-around for behaviour of `--all-targets` that was misunderstood. This PR removes that work-around and adds some tests and comments to clarify the behaviour for future contributors, which may help to make easier a future fix for #5177 and #5178.

6 years agoAuto merge of #5204 - lukaslueg:issue5199, r=alexcrichton
bors [Wed, 21 Mar 2018 13:56:00 +0000 (13:56 +0000)]
Auto merge of #5204 - lukaslueg:issue5199, r=alexcrichton

Do not allow crate-type or proc-macro for [[bin]]-targets

Fixes #5199

This simply disallows `proc-macro` and `crate-type` to be set to anything for binary targets. Is this the best way to go or does a warning about the unused setting suffice?

6 years agoPreprobe info for known crate type
Aleksey Kladov [Wed, 21 Mar 2018 07:54:15 +0000 (10:54 +0300)]
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.

6 years agodocs(tests): Add comment
Klaus Purer [Tue, 20 Mar 2018 22:05:20 +0000 (23:05 +0100)]
docs(tests): Add comment

6 years agotests(resolver): Add test for minimum dependency versions
Klaus Purer [Tue, 20 Mar 2018 21:33:10 +0000 (22:33 +0100)]
tests(resolver): Add test for minimum dependency versions

6 years agodocs(resolver): Comment for what the minimal_versions flag does
Klaus Purer [Sun, 18 Mar 2018 21:38:44 +0000 (22:38 +0100)]
docs(resolver): Comment for what the minimal_versions flag does

6 years agofeat(resolver): Add CLI option to resolve minimal version dependencies
Klaus Purer [Sun, 18 Mar 2018 21:20:22 +0000 (22:20 +0100)]
feat(resolver): Add CLI option to resolve minimal version dependencies

6 years agoAuto merge of #5215 - alexcrichton:update-version, r=matklad
bors [Tue, 20 Mar 2018 19:05:44 +0000 (19:05 +0000)]
Auto merge of #5215 - alexcrichton:update-version, r=matklad

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.

6 years agoDon't require `cargo update` when bumping versions
Alex Crichton [Tue, 20 Mar 2018 18:38:25 +0000 (11:38 -0700)]
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.

6 years agoDo not allow crate-type or proc-macro for [[bin]]-targets
Lukas Lueg [Mon, 19 Mar 2018 17:23:40 +0000 (18:23 +0100)]
Do not allow crate-type or proc-macro for [[bin]]-targets
in the current workspace.

Fixes #5199.

6 years agoAuto merge of #5206 - lukaslueg:patch-1, r=matklad
bors [Tue, 20 Mar 2018 13:27:30 +0000 (13:27 +0000)]
Auto merge of #5206 - lukaslueg:patch-1, r=matklad

Update CONTRIBUTING.md

Since a13a33c33b049a7b412f0cc80a7b166b0d58345c code is rejected during CI if `rustfmt` complains. Update the docs regarding that fact.

6 years agoAuto merge of #5209 - matklad:no-way-we-havent-had-a-test-for-this, r=alexcrichton
bors [Tue, 20 Mar 2018 00:38:44 +0000 (00:38 +0000)]
Auto merge of #5209 - matklad:no-way-we-havent-had-a-test-for-this, r=alexcrichton

Fix regression when passing arguments to subcommands

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

`.args(&args[1..])` was copied directly from the docopt implementation, but there, `args[0]` was the path to `cargo` and not the name of subcommand, ie, `args` were *original* arguments for Cargo as a whole.

6 years agoFix regression when passing arguments to subcommands
Aleksey Kladov [Mon, 19 Mar 2018 21:31:37 +0000 (00:31 +0300)]
Fix regression when passing arguments to subcommands

6 years agoAuto merge of #5202 - matklad:paths, r=alexcrichton
bors [Tue, 20 Mar 2018 00:02:17 +0000 (00:02 +0000)]
Auto merge of #5202 - matklad:paths, r=alexcrichton

Extract common code for dealing with path-valued arguments

Just a small refactoring to make sure all path arguments are treated in the same way.

6 years agoAuto merge of #5195 - alexcrichton:resolver-docs, r=Eh2406
bors [Mon, 19 Mar 2018 22:23:35 +0000 (22:23 +0000)]
Auto merge of #5195 - alexcrichton:resolver-docs, r=Eh2406

Add some documentation to the resolver

I spent a few hours yesterday re-teaching myself the resolver and wanted to add some comments along the way!

6 years agoAuto merge of #5207 - matklad:clap-test, r=matklad
bors [Mon, 19 Mar 2018 21:42:05 +0000 (21:42 +0000)]
Auto merge of #5207 - matklad:clap-test, r=matklad

Regression tests for #5201

Better safe than sorry!

6 years agoAdd some documentation to the resolver
Alex Crichton [Thu, 15 Mar 2018 22:53:21 +0000 (15:53 -0700)]
Add some documentation to the resolver

This is currently my best-effort attempt to document various portions of the
resolver with the logic that's been added recently. It at least helped me
understand a bit what was going on so I hope it can help others as well!

6 years agoRegression tests for #5201
Aleksey Kladov [Mon, 19 Mar 2018 20:13:04 +0000 (23:13 +0300)]
Regression tests for #5201

Better safe than sorry!

6 years agoExtract common code for dealing with path-valued arguments
Aleksey Kladov [Mon, 19 Mar 2018 12:40:33 +0000 (15:40 +0300)]
Extract common code for dealing with path-valued arguments

6 years agoUpdate CONTRIBUTING.md
lukaslueg [Mon, 19 Mar 2018 18:40:39 +0000 (19:40 +0100)]
Update CONTRIBUTING.md

Since a13a33c33b049a7b412f0cc80a7b166b0d58345c code is rejected during CI if `rustfmt` complains. Update the docs regarding that fact.

6 years agoSplit tests, apparently `cargo clean` does not work well on windows
Ximin Luo [Mon, 19 Mar 2018 17:20:54 +0000 (18:20 +0100)]
Split tests, apparently `cargo clean` does not work well on windows

6 years agoAuto merge of #5187 - Eh2406:faster_resolver, r=alexcrichton
bors [Sat, 17 Mar 2018 17:49:24 +0000 (17:49 +0000)]
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.

6 years agoWhen activating for the better error messages don't waste time on the other backtrack...
Eh2406 [Sat, 17 Mar 2018 14:07:13 +0000 (10:07 -0400)]
When activating for the better error messages don't waste time on the other backtrack frames

6 years agoWhen test backtracking include conflicts in `remaining_candidates`
Eh2406 [Sat, 17 Mar 2018 01:40:13 +0000 (21:40 -0400)]
When test backtracking include conflicts in `remaining_candidates`

6 years agoAuto merge of #5197 - matklad:neater-tests, r=alexcrichton
bors [Fri, 16 Mar 2018 21:13:21 +0000 (21:13 +0000)]
Auto merge of #5197 - matklad:neater-tests, r=alexcrichton

Slightly improve ergonomics of writing Cargo tests

As discussed in https://github.com/rust-lang/cargo/pull/5196#discussion_r175110557

I've also employed this to some of the longer command-lines in our test suite :)

6 years agoSlightly improve ergonomics of writing Cargo tests
Aleksey Kladov [Fri, 16 Mar 2018 17:03:27 +0000 (20:03 +0300)]
Slightly improve ergonomics of writing Cargo tests

6 years agoRevert "Clean the `backtrack_stack` so we don't backtrack to a place with cashed...
Eh2406 [Fri, 16 Mar 2018 19:10:58 +0000 (15:10 -0400)]
Revert "Clean the `backtrack_stack` so we don't backtrack to a place with cashed bad activations"

6 years agoremove duplicated adding to the cache
Eh2406 [Fri, 16 Mar 2018 16:31:30 +0000 (12:31 -0400)]
remove duplicated adding to the cache

6 years agoAuto merge of #5192 - matklad:hash-set-all-the-way-down, r=alexcrichton
bors [Fri, 16 Mar 2018 16:06:28 +0000 (16:06 +0000)]
Auto merge of #5192 - matklad:hash-set-all-the-way-down, r=alexcrichton

Avoid intermediate vector

Just a microoptimization to avoid intermediate `Vec`

6 years agoAvoid intermediate vector
Aleksey Kladov [Fri, 16 Mar 2018 09:29:54 +0000 (12:29 +0300)]
Avoid intermediate vector

6 years agoAuto merge of #5196 - matklad:clapclapclap, r=alexcrichton
bors [Fri, 16 Mar 2018 15:08:24 +0000 (15:08 +0000)]
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 :)

6 years agoFix a regression with parsing multivalue options
Aleksey Kladov [Fri, 16 Mar 2018 14:35:13 +0000 (17:35 +0300)]
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.

6 years agoAuto merge of #5193 - matklad:deny-warnings, r=alexcrichton
bors [Fri, 16 Mar 2018 14:28:53 +0000 (14:28 +0000)]
Auto merge of #5193 - matklad:deny-warnings, r=alexcrichton

Deny warnings in tests

6 years agoDeny warnings in tests
Aleksey Kladov [Fri, 16 Mar 2018 09:32:31 +0000 (12:32 +0300)]
Deny warnings in tests

6 years agosuggestions
Eh2406 [Fri, 16 Mar 2018 03:06:19 +0000 (23:06 -0400)]
suggestions

6 years agoAuto merge of #5190 - mbrubeck:doc, r=alexcrichton
bors [Thu, 15 Mar 2018 22:35:24 +0000 (22:35 +0000)]
Auto merge of #5190 - mbrubeck:doc, r=alexcrichton

Remove old note about pre-1.21 versions

None

6 years agoRemove old note about pre-1.21 versions
Matt Brubeck [Thu, 15 Mar 2018 22:24:09 +0000 (15:24 -0700)]
Remove old note about pre-1.21 versions

6 years agoAuto merge of #5188 - alexcrichton:urgh-again, r=matklad
bors [Thu, 15 Mar 2018 20:17:46 +0000 (20:17 +0000)]
Auto merge of #5188 - alexcrichton:urgh-again, r=matklad

Add a synthetic dependency on num-traits

Right now the rust-lang/rust integration is compiling Cargo twice on dist
builds, once for Cargo and once for the RLS. This is due to a dependency of
Cargo being recompiled with different features when used from the RLS or not.
For now paper over this problem with a synthetic dependency to prevent Cargo
from being compiled twice.

6 years agocargo +stable fmt
Eh2406 [Thu, 15 Mar 2018 19:02:40 +0000 (15:02 -0400)]
cargo +stable fmt

6 years agoAdd a synthetic dependency on num-traits
Alex Crichton [Thu, 15 Mar 2018 18:00:32 +0000 (11:00 -0700)]
Add a synthetic dependency on num-traits

Right now the rust-lang/rust integration is compiling Cargo twice on dist
builds, once for Cargo and once for the RLS. This is due to a dependency of
Cargo being recompiled with different features when used from the RLS or not.
For now paper over this problem with a synthetic dependency to prevent Cargo
from being compiled twice.

6 years agoadd a test
Eh2406 [Thu, 15 Mar 2018 17:30:42 +0000 (13:30 -0400)]
add a test

6 years agoRename stuff for clarity
Ximin Luo [Thu, 15 Mar 2018 15:57:58 +0000 (16:57 +0100)]
Rename stuff for clarity

- generate_{auto => default}_target since it matches on CompileFilter::Default
- CompileFilter::{matches => target_run} to make it clear it only affects `cargo run`
- Add a comment pointing to generate_target for other subcommands

6 years agoAdd tests for --all-targets
Ximin Luo [Thu, 15 Mar 2018 15:20:15 +0000 (16:20 +0100)]
Add tests for --all-targets

6 years agoFix need_dev_deps to return false during a default `cargo build` run
Ximin Luo [Thu, 15 Mar 2018 15:17:55 +0000 (16:17 +0100)]
Fix need_dev_deps to return false during a default `cargo build` run

- Also add a mode param to need_dev_deps to make clear the intent

6 years agoRevert "Work around #5134 for now"
Ximin Luo [Thu, 15 Mar 2018 15:17:00 +0000 (16:17 +0100)]
Revert "Work around #5134 for now"

This reverts commit d46db71b3ff17dfc0f4be6308c8b94613d65a572.

6 years agoFix a bug in #5152 that causes rustc/rustdoc to fail unnecessarily
Ximin Luo [Wed, 14 Mar 2018 14:50:09 +0000 (15:50 +0100)]
Fix a bug in #5152 that causes rustc/rustdoc to fail unnecessarily

6 years agoAuto merge of #5180 - alexcrichton:transitive-update, r=matklad
bors [Thu, 15 Mar 2018 15:22:32 +0000 (15:22 +0000)]
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