]> git.proxmox.com Git - cargo.git/log
cargo.git
5 years agoRemove the `Key` type from `JobQueue`
Alex Crichton [Fri, 19 Apr 2019 17:27:58 +0000 (10:27 -0700)]
Remove the `Key` type from `JobQueue`

This isn't actually necessary with a bit of refactoring, and in general
it makes management of `JobQueue` simpler since there's one less type to
worry about. The one main usage of `Key` vs `Unit` was that `Key` was
`Send` to be placed in `Message`, but this was replaced by just
assigning each `Unit` an ever-increasing integer, and then `Finished`
contains the integer rather than the `Key` itself which we can map once
we get back to the main thread.

5 years agoRefactor JobQueue::run slightly
Alex Crichton [Fri, 19 Apr 2019 16:57:05 +0000 (09:57 -0700)]
Refactor JobQueue::run slightly

Take a `&Context` argument instead of a few component arguments, avoids
passing around some extraneous information.

5 years agoCorrect a condition to request jobserver tokens
Alex Crichton [Fri, 19 Apr 2019 16:47:01 +0000 (09:47 -0700)]
Correct a condition to request jobserver tokens

This looks like it was a bug ever present from the original
implementation of a GNU jobserver in #4110, but we currently
unconditionally request a token is allocated for any job we pull off our
job queue. Rather we only need to request tokens for everything but the
first job because we already have an implicit token for that job.

5 years agoRemove the `Vec<Job>` from `DependencyQueue`
Alex Crichton [Fri, 19 Apr 2019 16:42:53 +0000 (09:42 -0700)]
Remove the `Vec<Job>` from `DependencyQueue`

I... don't think this needed any more! Doing some digging looks like
this was originally added in 79768eb0d. That was so early it didn't even
use a PR and was almost 5 years ago. Since then we've had a huge number
of changes to the backend and `Unit` nowadays does all the deduplication
we need, so no need to store a `Vec` here and we can just have a mapping
of `Key` to `Job` and that's it.

5 years agoAuto merge of #6863 - daxpedda:patch-1, r=alexcrichton
bors [Fri, 19 Apr 2019 15:05:03 +0000 (15:05 +0000)]
Auto merge of #6863 - daxpedda:patch-1, r=alexcrichton

Improved docs for `maintenance` options

I thought the lack of clear meanings for the available options could use some improvement.
Basically an upgrade of #4431.

Got the relevant text from rust-lang/crates.io#704 and the corresponding [rfc](https://github.com/rust-lang/rfcs/blob/master/text/1824-crates.io-default-ranking.md)

*Questions*
1. Should I put the descriptions outside of the code block?
2. I copied the wording including "maintainer" and "author", should I replace it with "you" or something more appropriate?

5 years agoImproved docs for `maintenance` options
daxpedda [Fri, 19 Apr 2019 14:04:14 +0000 (16:04 +0200)]
Improved docs for `maintenance` options

I thought the lack of clear meanings for the available options could use some improvement.
Basically an upgrade of #4431.

Got the relevant text from rust-lang/crates.io#704 and the corresponding [rfc](https://github.com/rust-lang/rfcs/blob/master/text/1824-crates.io-default-ranking.md)

*Questions*
1. Should I put the descriptions outside of the code block?
2. I copied the wording including "maintainer" and "author", should I replace it with "you" or something more appropriate?

5 years agoAuto merge of #6840 - ehuss:publish-lockfile-updates, r=alexcrichton
bors [Thu, 18 Apr 2019 16:01:11 +0000 (16:01 +0000)]
Auto merge of #6840 - ehuss:publish-lockfile-updates, r=alexcrichton

publish-lockfile: Various updates

This is a collection of changes to the `publish-lockfile` feature. They are separated by commit (see each for more detailed commit messages), and I can separate them into separate PRs if necessary.

- Move publish-lockfile tests to a dedicated file.
- Regenerate `Cargo.lock` when creating a package.
- Ignore `Cargo.lock` in `cargo install` by default (requires `--locked` to use).
- Add warnings for yanked dependencies.
- Change default of publish-lockfile to true.

5 years agoAuto merge of #6861 - fluffysquirrels:http2-stream-error-spurious, r=alexcrichton
bors [Thu, 18 Apr 2019 15:08:24 +0000 (15:08 +0000)]
Auto merge of #6861 - fluffysquirrels:http2-stream-error-spurious, r=alexcrichton

Treat HTTP/2 stream errors as spurious network errors.

Closes https://github.com/rust-lang/cargo/issues/6788.

5 years agoTreat HTTP/2 stream errors as spurious network errors.
Alex Helfet [Thu, 18 Apr 2019 10:33:15 +0000 (11:33 +0100)]
Treat HTTP/2 stream errors as spurious network errors.

5 years agoInclude Cargo.lock in package checks.
Eric Huss [Wed, 17 Apr 2019 21:06:05 +0000 (14:06 -0700)]
Include Cargo.lock in package checks.

This includes `Cargo.lock` in the git dirty check. It explicitly excludes
`Cargo.lock` as an untracked file, since it is not relevant for the dirty check;
it is only checked if it is committed to git.

This also adds `Cargo.lock` to the "did anything modify this" check during
verification. I don't see a reason to exclude it (particularly since ephemeral
workspaces do not save the lock file).

Also add "Archiving: Cargo.lock" to the verbose output.

5 years agoAuto merge of #6854 - fluffysquirrels:validate-login, r=alexcrichton
bors [Wed, 17 Apr 2019 14:56:24 +0000 (14:56 +0000)]
Auto merge of #6854 - fluffysquirrels:validate-login, r=alexcrichton

Validate registry token before operations that require it.

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

5 years agoAuto merge of #6856 - glandium:DYLD_FALLBACK_LIBRARY_PATH, r=alexcrichton
bors [Wed, 17 Apr 2019 14:04:03 +0000 (14:04 +0000)]
Auto merge of #6856 - glandium:DYLD_FALLBACK_LIBRARY_PATH, r=alexcrichton

Cleanups wrt DYLD_FALLBACK_LIBRARY_PATH handling

5 years agoAvoid adding DYLD_FALLBACK_LIBRARY_PATH defaults when it is set
Mike Hommey [Tue, 16 Apr 2019 23:37:46 +0000 (08:37 +0900)]
Avoid adding DYLD_FALLBACK_LIBRARY_PATH defaults when it is set

The macos dynamic linker behavior wrt DYLD_FALLBACK_LIBRARY_PATH is to
use the value it is set with, and if there is no such value (the
environment variable is either not set or set but empty), it uses a
default value of $HOME/lib:/usr/local/lib:/usr/lib.

Currently, cargo takes the value of DYLD_FALLBACK_LIBRARY_PATH, prepends
its paths to it, and then unconditionally adds
$HOME/lib:/usr/local/lib:/usr/lib, which in principle, shouldn't happen
if DYLD_FALLBACK_LIBRARY_PATH was set originally.

5 years agoReset DYLD_FALLBACK_LIBRARY_PATH during run_link_system_path_macos test
Mike Hommey [Tue, 16 Apr 2019 04:49:40 +0000 (13:49 +0900)]
Reset DYLD_FALLBACK_LIBRARY_PATH during run_link_system_path_macos test

5 years agoRemove `source` from compile_ws.
Eric Huss [Tue, 16 Apr 2019 18:33:07 +0000 (11:33 -0700)]
Remove `source` from compile_ws.

This was added for `cargo install` to avoid updating the source multiple times.
Now that multiple updates are guarded via `Config::updated_sources`, it is
no longer necessary.

5 years agoAvoid multiple index updates.
Eric Huss [Tue, 16 Apr 2019 18:03:20 +0000 (11:03 -0700)]
Avoid multiple index updates.

This also restores the Cargo.lock update during packaging.

5 years agoAdd check token before verify tests.
Alex Helfet [Tue, 16 Apr 2019 16:52:07 +0000 (17:52 +0100)]
Add check token before verify tests.

5 years agoAlter `cargo package` Cargo.lock modification note.
Eric Huss [Tue, 16 Apr 2019 16:06:59 +0000 (09:06 -0700)]
Alter `cargo package` Cargo.lock modification note.

Try to make it clearer that it is not modifying the actual Cargo.lock file, but
the one that is being stored in the .crate file.

5 years agoAuto merge of #6857 - ehuss:fix-new_warning_with_corrupt_ws, r=alexcrichton
bors [Tue, 16 Apr 2019 16:02:11 +0000 (16:02 +0000)]
Auto merge of #6857 - ehuss:fix-new_warning_with_corrupt_ws, r=alexcrichton

Fix new_warning_with_corrupt_ws missing "USER".

Also removed USER in all invocations to avoid this in the future.

5 years agocargo publish: Revert back to extracting tar file.
Eric Huss [Sun, 14 Apr 2019 17:57:06 +0000 (10:57 -0700)]
cargo publish: Revert back to extracting tar file.

This constructs the new Cargo.lock in memory instead of writing it directly
to disk. The in-memory copy is added to the tar file directly.

5 years agocargo package: Change lock file updates from warning to requiring -v.
Eric Huss [Sun, 14 Apr 2019 00:33:42 +0000 (17:33 -0700)]
cargo package: Change lock file updates from warning to requiring -v.

5 years agoMake --locked required for `cargo install --path`, too.
Eric Huss [Sat, 13 Apr 2019 23:43:53 +0000 (16:43 -0700)]
Make --locked required for `cargo install --path`, too.

5 years agopublish-lockfile: Change default to `true`.
Eric Huss [Wed, 10 Apr 2019 03:00:57 +0000 (20:00 -0700)]
publish-lockfile: Change default to `true`.

The feature still needs to be enabled.

5 years agoAdd warnings for yanked dependencies.
Eric Huss [Wed, 10 Apr 2019 02:00:40 +0000 (19:00 -0700)]
Add warnings for yanked dependencies.

This only applies for `cargo package/publish` with the publish-lockfile feature,
or `cargo install --locked`.

5 years agocargo install: Ignore Cargo.lock for non --path installs.
Eric Huss [Mon, 8 Apr 2019 01:26:08 +0000 (18:26 -0700)]
cargo install: Ignore Cargo.lock for non --path installs.

Requires `--locked` to use Cargo.lock for registry and git installs.

5 years agopublish-lockfile: Always check Cargo.lock is up-to-date.
Eric Huss [Sun, 7 Apr 2019 21:58:56 +0000 (14:58 -0700)]
publish-lockfile: Always check Cargo.lock is up-to-date.

This changes it so that `cargo package` will make sure the Cargo.lock file is
in sync with the Cargo.toml that is generated during packaging. This has several
points:

- This makes the Cargo.lock more accurately reflect what would be locked
  if a user runs `cargo install` on the resulting package.
- In a workspace, this removes irrelevant packages from the lock file.
- This handles `[patch]` dependencies and dual-source dependencies (like
  path/version).
- Warnings are generated for any differences in the lock file compared to the
  original.

This has a significant change in how `cargo package` works. It now
unconditionally copies the package to `target/package`. Previously this was only
done during the verification step. This is necessary to run the resolver against
the new `Cargo.toml` that gets generated.

5 years agoMove publish-lockfile tests to a dedicated file.
Eric Huss [Fri, 5 Apr 2019 20:25:08 +0000 (13:25 -0700)]
Move publish-lockfile tests to a dedicated file.

5 years agoFix new_warning_with_corrupt_ws missing "USER".
Eric Huss [Tue, 16 Apr 2019 15:35:58 +0000 (08:35 -0700)]
Fix new_warning_with_corrupt_ws missing "USER".

Also removed USER in all invocations to avoid this in the future.

5 years agoUse env::var_os("HOME") rather than env::var("HOME")
Mike Hommey [Tue, 16 Apr 2019 01:17:26 +0000 (10:17 +0900)]
Use env::var_os("HOME") rather than env::var("HOME")

Because the value is used to create a Path, there's no reason to go all
the way validating it is utf-8 (although in practice, it almost
certainly is, but it doesn't even matter).

5 years agoRemove /lib from DYLD_FALLBACK_LIBRARY_PATH
Mike Hommey [Tue, 16 Apr 2019 00:53:48 +0000 (09:53 +0900)]
Remove /lib from DYLD_FALLBACK_LIBRARY_PATH

While the manual page for dyld says the default used when
DYLD_FALLBACK_LIBRARY_PATH is not set is
$(HOME)/lib:/usr/local/lib:/lib:/usr/lib, its code actually says
```
sLibraryFallbackPaths[] = { "$HOME/lib", "/usr/local/lib", "/usr/lib", NULL };
```
as far back as the first version of dyld released in OSX 10.4:
https://opensource.apple.com/source/dyld/dyld-43/src/dyld.cpp.auto.html

(and the manual page was wrong back then too
https://opensource.apple.com/source/dyld/dyld-43/doc/man/man1/dyld.1.auto.html)

It is better to avoid putting more paths than necessary in this variable.

5 years agoAuto merge of #6855 - ehuss:clippy-redundant_closure, r=nrc
bors [Mon, 15 Apr 2019 21:24:30 +0000 (21:24 +0000)]
Auto merge of #6855 - ehuss:clippy-redundant_closure, r=nrc

Ignore Clippy redundant_closure

I think sometimes the closure is easier to read. Compare

```rust
x.map(|s| s.to_string())
```

vs

```rust
x.map(std::string::ToString::to_string)
```

I think it is also easier to modify when it is a closure. However, I don't feel strongly about it, so if anyone wants the Clippy form, I'm fine with switching things over to that.

5 years agoIgnore Clippy redundant_closure
Eric Huss [Mon, 15 Apr 2019 20:49:04 +0000 (13:49 -0700)]
Ignore Clippy redundant_closure

5 years agoAuto merge of #6849 - johnbartholomew:issue-2511-cargo-non-utf8-args, r=alexcrichton
bors [Mon, 15 Apr 2019 19:55:20 +0000 (19:55 +0000)]
Auto merge of #6849 - johnbartholomew:issue-2511-cargo-non-utf8-args, r=alexcrichton

Pass OsStr/OsString args through to the process spawned by cargo run.

This is intended to fix #2511, allowing non-UTF8 arguments to be passed through from cargo run to the spawned process. I was not sure whether the interface of cargo::ops needs to remain unchanged - I assume it does, so I added cargo::ops::run_os() taking &[OsString], and retained cargo::ops::run() with its current signature. If it's ok to change the internal cargo API then it may be better to just pass &[OsString] to run().

I have not tried to pass through OsStr/OsString to other places that could reasonably use them. Just one test added covering this path. It is restricted to `cfg(unix)` due to use of `std::os::unix::ffi::OsStrExt`.

This is my first pull request so I expect there will be changes needed to make this mergeable.

5 years agoAuto merge of #6852 - ehuss:version-bump, r=alexcrichton
bors [Mon, 15 Apr 2019 19:32:13 +0000 (19:32 +0000)]
Auto merge of #6852 - ehuss:version-bump, r=alexcrichton

Bump to 0.37.0

5 years agoBump to 0.37.0
Eric Huss [Mon, 15 Apr 2019 19:09:02 +0000 (12:09 -0700)]
Bump to 0.37.0

5 years agoRemove ops::run_os, change ops::run to take &[OsString] directly.
John Bartholomew [Mon, 15 Apr 2019 18:26:42 +0000 (19:26 +0100)]
Remove ops::run_os, change ops::run to take &[OsString] directly.

5 years agoValidate registry token before operations that require it.
Alex Helfet [Mon, 15 Apr 2019 18:00:42 +0000 (19:00 +0100)]
Validate registry token before operations that require it.

5 years agoAuto merge of #6850 - ehuss:fix-include_overrides_gitignore, r=alexcrichton
bors [Mon, 15 Apr 2019 14:36:55 +0000 (14:36 +0000)]
Auto merge of #6850 - ehuss:fix-include_overrides_gitignore, r=alexcrichton

Fix test include_overrides_gitignore.

This test was added in #4180 and was disabled in #4218.  I don't think it is really feasible to get filetime into the test. The test was also using some questionable behavior of modifying contents of `src` from a `build.rs` script.  I rewrote the test to directly test the original change of having `package.include` override `.gitignore`.

5 years agoAuto merge of #6851 - danielcompton:patch-1, r=Eh2406
bors [Mon, 15 Apr 2019 01:36:17 +0000 (01:36 +0000)]
Auto merge of #6851 - danielcompton:patch-1, r=Eh2406

Clarify optional registry key behaviour

Changing from "and" to "but" makes the sentence clearer to read. I think it gives the reader an appropriate caution, as you do lose features if you don't provide the `api` key.

5 years agoClarify optional registry key behaviour
Daniel Compton [Mon, 15 Apr 2019 00:19:07 +0000 (12:19 +1200)]
Clarify optional registry key behaviour

5 years agoFix test include_overrides_gitignore.
Eric Huss [Sun, 14 Apr 2019 18:50:41 +0000 (11:50 -0700)]
Fix test include_overrides_gitignore.

5 years agoPass OsStr/OsString args through to the process spawned by cargo run.
John Bartholomew [Sun, 14 Apr 2019 14:38:59 +0000 (15:38 +0100)]
Pass OsStr/OsString args through to the process spawned by cargo run.

To avoid breaking other (external) callers of ops::run(), this adds a
new function ops::run_os() taking an &[OsString], and turns ops::run()
into a wrapper (keeping its original signature) that calls run_os().

5 years agoAuto merge of #6842 - alexcrichton:set-cksum, r=ehuss
bors [Sat, 13 Apr 2019 00:04:57 +0000 (00:04 +0000)]
Auto merge of #6842 - alexcrichton:set-cksum, r=ehuss

Ensure Summary::checksum works for registry crates

While not actually used in Cargo itself the `Summary::checksum` method
of downloaded packages from the registry currently returns `None`. This
was accidentally regressed in #6500 and noticed when updating
`cargo-vendor` (it took a long time to get around to updating that).

The fix here is to override the `checksum` field of the summary for
packages we return from the registry, and everything else should remain
the same!

5 years agoEnsure Summary::checksum works for registry crates
Alex Crichton [Fri, 12 Apr 2019 16:42:51 +0000 (09:42 -0700)]
Ensure Summary::checksum works for registry crates

While not actually used in Cargo itself the `Summary::checksum` method
of downloaded packages from the registry currently returns `None`. This
was accidentally regressed in #6500 and noticed when updating
`cargo-vendor` (it took a long time to get around to updating that).

The fix here is to override the `checksum` field of the summary for
packages we return from the registry, and everything else should remain
the same!

5 years agoAuto merge of #6841 - ehuss:err-walk-access, r=dwijnand
bors [Fri, 12 Apr 2019 05:44:48 +0000 (05:44 +0000)]
Auto merge of #6841 - ehuss:err-walk-access, r=dwijnand

Better error if PathSource::walk can't access something.

Reported at https://github.com/rust-lang/cargo/issues/6757#issuecomment-481847354.

5 years agoBetter error if PathSource::walk can't access something.
Eric Huss [Fri, 12 Apr 2019 01:28:45 +0000 (18:28 -0700)]
Better error if PathSource::walk can't access something.

5 years agoAuto merge of #6839 - ehuss:new-error-causes, r=alexcrichton
bors [Thu, 11 Apr 2019 21:26:59 +0000 (21:26 +0000)]
Auto merge of #6839 - ehuss:new-error-causes, r=alexcrichton

Improve warning in `cargo new` with parse error.

If `cargo new` fails to load a parent manifest (for whatever reason), it as not
displaying the reason why. Add the causes to provide more context.

5 years agoImprove warning in `cargo new` with parse error.
Eric Huss [Thu, 11 Apr 2019 19:29:21 +0000 (12:29 -0700)]
Improve warning in `cargo new` with parse error.

If `cargo new` fails to load a parent manifest (for whatever reason), it as not
displaying the reason why. Add the causes to provide more context.

5 years agoAuto merge of #6838 - ehuss:publish-error-msg, r=alexcrichton
bors [Thu, 11 Apr 2019 19:11:07 +0000 (19:11 +0000)]
Auto merge of #6838 - ehuss:publish-error-msg, r=alexcrichton

Improve error message for `publish` key restriction.

The existing error message didn't really recognize that `publish` can be a
list.

This also adds support for `publish = ["crates-io"]` to restrict publishing
to crates.io only.

5 years agoImprove error message for `publish` key restriction.
Eric Huss [Thu, 11 Apr 2019 18:34:00 +0000 (11:34 -0700)]
Improve error message for `publish` key restriction.

The existing error message didn't really recognize that `publish` can be a
list.

This also adds support for `publish = ["crates-io"]` to restrict publishing
to crates.io only.

5 years agoAuto merge of #6832 - alexcrichton:freshness, r=ehuss
bors [Thu, 11 Apr 2019 17:52:18 +0000 (17:52 +0000)]
Auto merge of #6832 - alexcrichton:freshness, r=ehuss

Remove `Freshness` from `DependencyQueue`

Ever since the inception of Cargo and the advent of incremental
compilation at the crate level via Cargo, Cargo has tracked whether it
needs to recompile something at a unit level in its "dependency queue"
which manages when items are ready for execution. Over time we've fixed
lots and lots of bugs related to incremental compilation, and perhaps
one of the most impactful realizations was that the model Cargo started
with fundamentally doesn't handle interrupting Cargo halfway through and
resuming the build later.

The previous model relied upon implicitly propagating "dirtiness" based
on whether the one of the dependencies of a build was rebuilt or not.
This information is not available, however, if Cargo is interrupted and
resumed (or performs a subset of steps and then later performs more).
We've fixed this in a number of places historically but the purpose of
this commit is to put a nail in this coffin once and for all.

Implicit propagation of whether a unit is fresh or dirty is no longer
present at all. Instead Cargo should always know, irrespective of it's
in-memory state, whether a unit needs to be recompiled or not. This
commit actually turns up a few bugs in the test suite, so later commits
will be targeted at fixing this.

Note that this required a good deal of work on the `fingerprint` module
to fix some longstanding bugs (like #6780) and some serious hoops had to
be jumped through for others (like #6779). While these were fallout from
this change they weren't necessarily the primary motivation, but rather
to help make `fingerprints` a bit more straightforward in what's an
already confusing system!

Closes #6780

5 years agoMove `Fingerprint::local` into a `Mutex`
Alex Crichton [Thu, 11 Apr 2019 16:27:13 +0000 (09:27 -0700)]
Move `Fingerprint::local` into a `Mutex`

Removes the need for a wonky `with_local` method!

5 years agoHandle some review comments
Alex Crichton [Thu, 11 Apr 2019 16:18:15 +0000 (09:18 -0700)]
Handle some review comments

5 years agoRemove a debugging call to `stream()`
Alex Crichton [Wed, 10 Apr 2019 17:42:30 +0000 (10:42 -0700)]
Remove a debugging call to `stream()`

5 years agoTouch up comments in fingerprint file
Alex Crichton [Tue, 9 Apr 2019 19:10:38 +0000 (12:10 -0700)]
Touch up comments in fingerprint file

5 years agoFix a TODO by deduplicating with a common function
Alex Crichton [Tue, 9 Apr 2019 18:43:11 +0000 (11:43 -0700)]
Fix a TODO by deduplicating with a common function

5 years agoPurge mtime information from `Fingerprint`
Alex Crichton [Tue, 9 Apr 2019 18:37:31 +0000 (11:37 -0700)]
Purge mtime information from `Fingerprint`

This has proven to be a very unreliable piece of information to hash, so
let's not! Instead we track what files are supposed to be relative to,
and we check both mtimes when necessary.

5 years agoRemove `Freshness` from `DependencyQueue`
Alex Crichton [Fri, 5 Apr 2019 19:54:50 +0000 (12:54 -0700)]
Remove `Freshness` from `DependencyQueue`

Ever since the inception of Cargo and the advent of incremental
compilation at the crate level via Cargo, Cargo has tracked whether it
needs to recompile something at a unit level in its "dependency queue"
which manages when items are ready for execution. Over time we've fixed
lots and lots of bugs related to incremental compilation, and perhaps
one of the most impactful realizations was that the model Cargo started
with fundamentally doesn't handle interrupting Cargo halfway through and
resuming the build later.

The previous model relied upon implicitly propagating "dirtiness" based
on whether the one of the dependencies of a build was rebuilt or not.
This information is not available, however, if Cargo is interrupted and
resumed (or performs a subset of steps and then later performs more).
We've fixed this in a number of places historically but the purpose of
this commit is to put a nail in this coffin once and for all.

Implicit propagation of whether a unit is fresh or dirty is no longer
present at all. Instead Cargo should always know, irrespective of it's
in-memory state, whether a unit needs to be recompiled or not. This
commit actually turns up a few bugs in the test suite, so later commits
will be targeted at fixing this.

Note that this required a good deal of work on the `fingerprint` module
to fix some longstanding bugs (like #6780) and some serious hoops had to
be jumped through for others (like #6779). While these were fallout from
this change they weren't necessarily the primary motivation, but rather
to help make `fingerprints` a bit more straightforward in what's an
already confusing system!

Closes #6780

5 years agoRun `cargo fmt`
Alex Crichton [Fri, 5 Apr 2019 19:55:01 +0000 (12:55 -0700)]
Run `cargo fmt`

5 years agoAuto merge of #6837 - ehuss:remove-alt-reg-test, r=Eh2406
bors [Wed, 10 Apr 2019 02:14:35 +0000 (02:14 +0000)]
Auto merge of #6837 - ehuss:remove-alt-reg-test, r=Eh2406

testsuite: cleanup for `alternative-registries`

Remove some `alternative-registries` features that were accidentally left
behind.

5 years agotestsuite: cleanup for `alternative-registries`
Eric Huss [Wed, 10 Apr 2019 02:08:43 +0000 (19:08 -0700)]
testsuite: cleanup for `alternative-registries`

Remove some `alternative-registries` features that were accidentally left
behind.

5 years agoAuto merge of #6824 - ehuss:improve-test-rerun-hint, r=alexcrichton
bors [Mon, 8 Apr 2019 17:58:06 +0000 (17:58 +0000)]
Auto merge of #6824 - ehuss:improve-test-rerun-hint, r=alexcrichton

Improve error message to rerun a test in a workspace.

In a non-virtual workspace, if you run `cargo test --all` and something fails, it tells you to rerun `--test foo`, but if `foo` is not the default, then it won't work without a `-p` flag.  This tries to be a little more careful about when `-p` is needed in the hint.

5 years agoAuto merge of #6829 - ehuss:fix-mutable-borrow, r=alexcrichton
bors [Mon, 8 Apr 2019 17:32:47 +0000 (17:32 +0000)]
Auto merge of #6829 - ehuss:fix-mutable-borrow, r=alexcrichton

Fix mutable_borrow_reservation_conflict warning.

nightly-2019-04-08 added a more restrictive borrowing rule (rust-lang/rust#58739).

5 years agoFix mutable_borrow_reservation_conflict warning.
Eric Huss [Mon, 8 Apr 2019 17:05:45 +0000 (10:05 -0700)]
Fix mutable_borrow_reservation_conflict warning.

5 years agoImprove error message to rerun a test in a workspace.
Eric Huss [Sat, 6 Apr 2019 01:52:22 +0000 (18:52 -0700)]
Improve error message to rerun a test in a workspace.

5 years agoAuto merge of #6798 - ehuss:install-upgrade, r=alexcrichton
bors [Fri, 5 Apr 2019 18:29:47 +0000 (18:29 +0000)]
Auto merge of #6798 - ehuss:install-upgrade, r=alexcrichton

Add install-upgrade.

This implements the feature described in #6667. Instead of failing when `cargo install` detects a package is already installed, it will upgrade if the versions don't match, or do nothing (exit 0) if it is considered "up-to-date".

Closes #6667.

Notes:
- This feature rejects ambiguous `--version` input (such as `1.0`). This is not required, but seemed like a reasonable time to make the change.
- There is a slight change to the output on stable which reports what was installed/replaced.
- Added better support for `*` in `--version` (don't show warning).

5 years agoinstall-upgrade: Add some more comments.
Eric Huss [Fri, 5 Apr 2019 17:48:23 +0000 (10:48 -0700)]
install-upgrade: Add some more comments.

5 years agoAuto merge of #6823 - spl:clarify-install-path, r=alexcrichton
bors [Fri, 5 Apr 2019 13:26:24 +0000 (13:26 +0000)]
Auto merge of #6823 - spl:clarify-install-path, r=alexcrichton

Clarify docs of install without <crate>

This is an attempt to clarify the documentation of `install` without `<crate>`. I found it confusing trying to determine to which behavior “this” referred as well as whether “supported” meant “maintained” or “worked.”

5 years agoClarify docs of install without <crate>
Sean Leather [Fri, 5 Apr 2019 10:57:55 +0000 (12:57 +0200)]
Clarify docs of install without <crate>

5 years agoAuto merge of #6820 - ehuss:fix-edition-link, r=alexcrichton
bors [Thu, 4 Apr 2019 14:11:33 +0000 (14:11 +0000)]
Auto merge of #6820 - ehuss:fix-edition-link, r=alexcrichton

Fix doc link.

The rust linkchecker does not like directory-style links.

5 years agoinstall-upgrade: Fix bugs, more comments, review updates.
Eric Huss [Thu, 4 Apr 2019 01:05:55 +0000 (18:05 -0700)]
install-upgrade: Fix bugs, more comments, review updates.

5 years agoFix doc link.
Eric Huss [Wed, 3 Apr 2019 23:45:24 +0000 (16:45 -0700)]
Fix doc link.

The rust linkchecker does not like directory-style links.

5 years agoAuto merge of #6818 - dtolnay:comma, r=alexcrichton
bors [Wed, 3 Apr 2019 20:25:19 +0000 (20:25 +0000)]
Auto merge of #6818 - dtolnay:comma, r=alexcrichton

Accept trailing comma in test of impl Debug for PackageId

The standard library is planning to begin emitting trailing commas in multiline Debug representations to align with the dominant style in modern Rust code -- https://github.com/rust-lang/rust/pull/59076.

```diff
  PackageId {
      name: "foo",
      version: "1.0.0",
-     source: "registry `https://github.com/rust-lang/crates.io-index`"
+     source: "registry `https://github.com/rust-lang/crates.io-index`",
  }
```

For now, change this tests to accept both with and without trailing comma. Once the trailing comma change reaches the stable channel we will be able to remove one of the cases.

5 years agoAccept trailing comma in test of impl Debug for PackageId
David Tolnay [Wed, 3 Apr 2019 20:17:16 +0000 (13:17 -0700)]
Accept trailing comma in test of impl Debug for PackageId

The standard library is planning to begin emitting trailing commas in
multiline Debug representations to align with the dominant style in
modern Rust code.

      PackageId {
          name: "foo",
          version: "1.0.0",
    -     source: "registry `https://github.com/rust-lang/crates.io-index`"
    +     source: "registry `https://github.com/rust-lang/crates.io-index`",
      }

For now, change this tests to accept both with and without trailing
comma. Once the trailing comma change reaches the stable channel we will
be able to remove one of the cases.

5 years agoAuto merge of #6814 - ehuss:offline-optional-dep, r=alexcrichton
bors [Tue, 2 Apr 2019 22:03:55 +0000 (22:03 +0000)]
Auto merge of #6814 - ehuss:offline-optional-dep, r=alexcrichton

Resolve: Be less strict while offline.

When offline, the resolver was requiring everything to be downloaded, even dependencies that are not used. This changes it so that the resolver can still resolve unavailable dependencies when offline. This pushes the failure to a later stage of Cargo where it attempts to download the dependency. This makes `-Z offline` work for target-cfg or optional dependencies that are not being used.

Fixes #6014.

This changes the error message significantly for the "unavailable" case (see test diff). I personally think the new error message is clearer, although it is shorter and provides less information. The old error message seemed large and scary, and was a little hard for me to grok. However, I'd be willing to look at tweaking the error behavior if not everyone agrees.

5 years agoAuto merge of #6815 - ehuss:doc-downloads, r=Eh2406
bors [Tue, 2 Apr 2019 21:29:56 +0000 (21:29 +0000)]
Auto merge of #6815 - ehuss:doc-downloads, r=Eh2406

Add some docs for `Downloads`.

Rather than fight with rustfmt which didn't like the inline comment, I decided to just add some more elaborate docs.

5 years agoAdd some docs for `Downloads`.
Eric Huss [Tue, 2 Apr 2019 21:19:53 +0000 (14:19 -0700)]
Add some docs for `Downloads`.

5 years agoAuto merge of #6776 - Eh2406:resolver-simplification, r=alexcrichton
bors [Tue, 2 Apr 2019 20:44:10 +0000 (20:44 +0000)]
Auto merge of #6776 - Eh2406:resolver-simplification, r=alexcrichton

Resolver: A dep is equivalent to one of the things it can resolve to.

This is a series of small changes to the resolver, each one on its own is not worth the cherne, but somehow all together we can add a new optimization rule. The result is that the test in #6283 is no longer exponencial (still a large polynomial, cubick?) and so N can be bumped from 3 to 20. This also means that we pass with all the cases reported in #6258. Resolution is NP-Hard, so we are moving the slow cases around. To reduce the chance that we will be flooded by new bad cases I run the 4 proptests overnight, and they did not find a new exponencial case.

I would recommend reviewing this commit by commit. As each change is pretty simple on its own, but the mixed diff is harder to follow. This is submitted as one big PR as that is @alexcrichton's preference.

A special thanks to @nex3, our conversation was important in convincing me that several of these changes would be needed even in an eventual PubGrub based system. And, the question "why would PubGrub not have a problem with #6283" was wat crystallized this optimization opportunity in my mind.

5 years agoResolve: Be less strict while offline.
Eric Huss [Tue, 2 Apr 2019 20:27:42 +0000 (13:27 -0700)]
Resolve: Be less strict while offline.

5 years agoAdd install-upgrade.
Eric Huss [Sun, 31 Mar 2019 00:33:35 +0000 (17:33 -0700)]
Add install-upgrade.

5 years agoAuto merge of #6811 - ehuss:include-proc-macro, r=alexcrichton
bors [Tue, 2 Apr 2019 14:52:18 +0000 (14:52 +0000)]
Auto merge of #6811 - ehuss:include-proc-macro, r=alexcrichton

Include proc-macros in `build-override`.

This adds proc-macros (and their dependencies) to the `build-override` profile setting.  The motivation is that these are all "build time" dependencies, and as such should probably behave the same.  See the discussion on the [tracking issue](https://github.com/rust-lang/rust/issues/48683#issuecomment-472705245).  My intent is that this paves the way for stabilizing without necessarily waiting for #6577.

The only change here is the line in `with_for_host`, the rest is just renaming for clarity.

This also includes some of the testsuite changes from #6577 to make it easier to check for compiler flags.

5 years agoAuto merge of #6809 - ehuss:glossary-feature, r=alexcrichton
bors [Tue, 2 Apr 2019 14:27:14 +0000 (14:27 +0000)]
Auto merge of #6809 - ehuss:glossary-feature, r=alexcrichton

Update glossary for `feature`.

Added the newly documented `target_feature` to help people disambiguate
the various usages.

5 years agoAuto merge of #6812 - ehuss:wasm-example, r=alexcrichton
bors [Tue, 2 Apr 2019 14:02:15 +0000 (14:02 +0000)]
Auto merge of #6812 - ehuss:wasm-example, r=alexcrichton

Don't include metadata in wasm binary examples.

This removes the metadata hash from wasm example binaries, and consequently also includes the `.wasm` files in the artifact JSON message.

Closes #6810.

I renamed a method and added a new one to maybe make things a little clearer. This cannot be easily tested (see #4973).

5 years agoDon't include metadata in wasm binary examples.
Eric Huss [Mon, 1 Apr 2019 23:53:23 +0000 (16:53 -0700)]
Don't include metadata in wasm binary examples.

5 years agoInclude proc-macros in `build-override`.
Eric Huss [Mon, 1 Apr 2019 23:03:35 +0000 (16:03 -0700)]
Include proc-macros in `build-override`.

5 years agoUpdate glossary for `feature`.
Eric Huss [Mon, 1 Apr 2019 21:43:02 +0000 (14:43 -0700)]
Update glossary for `feature`.

Added the newly documented `target_feature` to help people disambiguate
the various usages.

5 years agoAuto merge of #6759 - yaahallo:cargo-clippy, r=alexcrichton
bors [Mon, 1 Apr 2019 17:23:19 +0000 (17:23 +0000)]
Auto merge of #6759 - yaahallo:cargo-clippy, r=alexcrichton

Cargo clippy

resolves https://github.com/rust-lang/rust-clippy/issues/3837

5 years agoRemove no longer needed fields in `BuildConfig`
Alex Crichton [Mon, 1 Apr 2019 17:22:23 +0000 (10:22 -0700)]
Remove no longer needed fields in `BuildConfig`

Now the fields are just all represented as `rustc_wrapper` which
internally contains all process configuration that's later passed down
to `Rustc` as necessary.

5 years agoAuto merge of #6800 - ehuss:git-cli-force, r=alexcrichton
bors [Mon, 1 Apr 2019 16:19:17 +0000 (16:19 +0000)]
Auto merge of #6800 - ehuss:git-cli-force, r=alexcrichton

Support force-pushed repos with git-fetch-with-cli.

If a git repo had a force push, then the `git-fetch-with-cli` feature would fail to fetch an update.  This adds the `--force` flag to force the fetch.  There's a bit of a lengthy discussion in the [git docs](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-ltrefspecgt) about why this is needed when a refspec is supplied.

I also changed it to remove the `--quiet` flag and to capture the output, which is only displayed on error.  I'm not sure what the reasoning for the `--quiet` flag was, but I don't see any harm since the output was previously unused.  This can maybe help people debug problems, however in this situation
all you would see is ` ! [rejected]        master     -> master  (non-fast-forward)` which isn't terribly informative.

Fixes #6795.

5 years agoAuto merge of #6801 - ehuss:install-flags, r=Eh2406
bors [Mon, 1 Apr 2019 14:12:58 +0000 (14:12 +0000)]
Auto merge of #6801 - ehuss:install-flags, r=Eh2406

cargo install: Be more restrictive about cli flags.

Several flags in `cargo install` are silently ignored depending on what is used. This adds some validation so that invalid combinations are rejected.  I have been sorta confused by these in the past.

- The 3 source flags (`--git`, `--path`, and `--registry`) are mutually exclusive.
- The `--git` flags (branch, tag, rev) are only valid if `--git` is specified.
- `--registry` requires a crate name (otherwise it would be ignored and treated as a path source).
- `--version` is only used when a crate name is specified.

5 years agoAuto merge of #6806 - ehuss:warn-semver-metadata, r=Eh2406
bors [Mon, 1 Apr 2019 12:55:31 +0000 (12:55 +0000)]
Auto merge of #6806 - ehuss:warn-semver-metadata, r=Eh2406

Warn on version req with metadata.

Metadata in a version requirement (such as `1.0.0+1234`) is ignored. This adds a warning that it will be ignored.

On crates.io I found about 5 crates, plus a few dozen google-* crates (presumably all created by the same person) which have dependencies of this form.

See discussion at https://github.com/rust-lang/cargo/issues/6504#issuecomment-451254084. cc rust-lang/crates.io#1059 for ongoing discussion about what to do about publishing such versions.

5 years agoAuto merge of #6805 - ehuss:hint-workspace-exclude, r=alexcrichton
bors [Mon, 1 Apr 2019 12:31:20 +0000 (12:31 +0000)]
Auto merge of #6805 - ehuss:hint-workspace-exclude, r=alexcrichton

Add more suggestions on how to deal with excluding a package from a workspace.

Closes #5418

5 years agoAuto merge of #6804 - ehuss:install-path-config2, r=alexcrichton
bors [Mon, 1 Apr 2019 12:06:29 +0000 (12:06 +0000)]
Auto merge of #6804 - ehuss:install-path-config2, r=alexcrichton

Allow `cargo install --path P` to load config from P.

`cargo install` was changed to ignore configs except for the home directory (#6026). However, it seems like there are legitimate needs when using `--path`, so allow loading from that path, too.

Closes #6498.
Closes #6397.

5 years agoAuto merge of #6803 - ehuss:doc-open-multi, r=alexcrichton
bors [Mon, 1 Apr 2019 11:42:02 +0000 (11:42 +0000)]
Auto merge of #6803 - ehuss:doc-open-multi, r=alexcrichton

Allow `cargo doc --open` with multiple packages.

If `cargo doc --open` builds multiple packages, open the first one. This seems pretty natural to me (the first one on the command line, or the first default member if `default-members` is specified, or the root of a workspace). Rustdoc shows a list of crates in the sidebar, so if it doesn't open the one the user wants, it's a trivial matter of clicking on the crate name.

@alexcrichton specifically asked for an error [here](https://github.com/rust-lang/cargo/pull/1828#discussion-diff-39650485). However, at the time I don't think rustdoc dynamically generated the "Crates" listing in the sidebar. Alex, I wonder if your stance still holds?

Closes #5145

5 years agoAuto merge of #6791 - ehuss:unstable-help, r=Eh2406
bors [Mon, 1 Apr 2019 11:17:42 +0000 (11:17 +0000)]
Auto merge of #6791 - ehuss:unstable-help, r=Eh2406

Add some help and documentation for unstable flags.

This is intended to give a little extra information about unstable flags.

- `-Z help` tells you if you can't use it on stable.
- `-Z help` includes link to the unstable chapter.
- `--out-dir` and `--build-plan` on stable give more information about what channels are and a link to their respective tracking issues.  Add links in the man pages, too.

5 years agoAuto merge of #6807 - ehuss:libc-warning, r=alexcrichton
bors [Mon, 1 Apr 2019 10:53:57 +0000 (10:53 +0000)]
Auto merge of #6807 - ehuss:libc-warning, r=alexcrichton

Fix unused import warning.

2019-04-01 nightly introduced a new warning (presumably rust-lang/rust#58805).

5 years agoFix unused import warning.
Eric Huss [Mon, 1 Apr 2019 02:37:26 +0000 (19:37 -0700)]
Fix unused import warning.

5 years agoWarn on version req with metadata.
Eric Huss [Mon, 1 Apr 2019 01:53:54 +0000 (18:53 -0700)]
Warn on version req with metadata.

5 years agoAdd more suggestions on how to deal with excluding a package from a workspace.
Eric Huss [Mon, 1 Apr 2019 00:48:15 +0000 (17:48 -0700)]
Add more suggestions on how to deal with excluding a package from a workspace.

5 years agoAllow `cargo install --path P` to load config from P.
Eric Huss [Mon, 1 Apr 2019 00:13:44 +0000 (17:13 -0700)]
Allow `cargo install --path P` to load config from P.