]> git.proxmox.com Git - cargo.git/log
cargo.git
4 years agoFixed a spelling and some clippy warnings
Hanif Bin Ariffin [Wed, 19 Aug 2020 22:20:51 +0000 (18:20 -0400)]
Fixed a spelling and some clippy warnings

4 years agoAuto merge of #8609 - ehuss:resolver-semver, r=Eh2406
bors [Wed, 19 Aug 2020 20:22:52 +0000 (20:22 +0000)]
Auto merge of #8609 - ehuss:resolver-semver, r=Eh2406

Add chapters on dependency resolution and SemVer compatibility.

This adds two documentation chapters, one on the resolver and one on SemVer compatibility. These are intended to help guide users on how to version their package and how to use dependencies.

I did not document `[patch]` resolution. Perhaps someday in the future the the "Overriding dependencies" chapter can be expanded to include more details on how patch works, and how to properly use it. I have a bunch of notes on this, but I want to defer it till later.

The SemVer compatibility guidelines were guided by [RFC 1105](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md), but are edited and expanded based on my own personal observations. I tried to highlight when some rules do not appear to have consensus on behavior. I would be happy for any additions or modifications to the rule list. I have a list of additional things to add, but I wanted to get the ball rolling, and it might take a while finish them.

Each compatibility entry has an example, and there is a small script which tests all the examples to ensure they work like they are supposed to. This script checks against the compiler output, which can be fragile over time. If that becomes too troublesome, we can probably find some more relaxed checks. I think checking the error is important because I've run into cases in the past where using basic "compile_fail" annotations were misleading because the examples were failing for the wrong reason.

Closes #7301

4 years agoAuto merge of #8611 - hbina:rename_into_url, r=ehuss
bors [Wed, 19 Aug 2020 19:30:21 +0000 (19:30 +0000)]
Auto merge of #8611 - hbina:rename_into_url, r=ehuss

Renames SourceId::into_url -> SourceId::as_url

While studying the source code, I am surprised to see that `into_url`
does not actually consume its caller when a function with such name
usually does. Additionally, there is a trait in `cargo::util::IntoUrl`
with the same and does exactly what you expect, consumes itself and yields
a `CargoResult<Url>`.

I hope this is not too nitpicky.
Thank you!

4 years agoAuto merge of #8629 - EmbarkStudios:master, r=ehuss
bors [Tue, 18 Aug 2020 16:52:45 +0000 (16:52 +0000)]
Auto merge of #8629 - EmbarkStudios:master, r=ehuss

Fix bug with PathAndArg config values

This fixes an issue I noticed when trying to specify a target runner via the [`CARGO_TARGET_{triplet}_RUNNER`](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) environment variable, expecting it to override the value in our `.cargo/config.toml` file, which was giving quite strange errors until I figured out that cargo was actually merging the config file's values with the environment's values.

This change adds a small hack to use and `UnmergedStringList` from `PathAndArgs` instead of just plain `StringList`, which uses the type in the deserializer to determine if `Config::get_list_or_string` should merge the values from the config file(s) with the environment as it was doing before, or else only use the environment to the exclusion of the config file(s) if the key was set in the environment.

I also added a test for this to confirm both the bug and the fix.

4 years agoAuto merge of #8627 - ehuss:run-proc-err, r=Eh2406
bors [Tue, 18 Aug 2020 15:08:14 +0000 (15:08 +0000)]
Auto merge of #8627 - ehuss:run-proc-err, r=Eh2406

Show full error context on `cargo run` error.

If there was an error exec-ing a process with `cargo run`, the error message was not displayed. The code was calling `downcast` to a `ProcessError` which erased the surrounding error context.  As shown in the modified test, it should now include a `Caused by:` message with the underlying error message.

4 years agoRemove debug only code
Jake Shadle [Mon, 17 Aug 2020 17:53:16 +0000 (19:53 +0200)]
Remove debug only code

4 years agoFix bug with PathAndArg config values
Jake Shadle [Mon, 17 Aug 2020 17:23:49 +0000 (19:23 +0200)]
Fix bug with PathAndArg config values

4 years agoShow full error context on `cargo run` error.
Eric Huss [Mon, 17 Aug 2020 15:43:19 +0000 (08:43 -0700)]
Show full error context on `cargo run` error.

4 years agoAuto merge of #8615 - davepacheco:sigquit-typo, r=ehuss
bors [Wed, 12 Aug 2020 23:26:46 +0000 (23:26 +0000)]
Auto merge of #8615 - davepacheco:sigquit-typo, r=ehuss

Fix typo in SIGQUIT description

This PR fixes a small typo in the SIGQUIT description.

(edit: removed my notes about automated tests because the PR bot has a more complete summary.)

In terms of manual testing: I had a test that raised `SIGQUIT` using the "coredump" crate.  Previously, it emitted:

```
error: test failed, to rerun pass '--test the_test'

Caused by:
  process didn't exit successfully: `/Users/dap/oxide/experiments/rust-coredump/target/debug/deps/the_test-a8a068307be90649 --nocapture` (signal: 3, SIGQUIT: terminal quite signal)
```

Now, it emits:

```
error: test failed, to rerun pass '--test the_test'

Caused by:
  process didn't exit successfully: `/Users/dap/oxide/experiments/rust-coredump/target/debug/deps/the_test-20c8e90133861ece --nocapture` (signal: 3, SIGQUIT: terminal quit signal)
```

which looks correct.

4 years agoFix typo in SIGQUIT description
David Pacheco [Wed, 12 Aug 2020 22:27:45 +0000 (15:27 -0700)]
Fix typo in SIGQUIT description

4 years agoRenamed SourceIdIntoUrl -> SourceIdAsUrl
Hanif Bin Ariffin [Tue, 11 Aug 2020 21:46:47 +0000 (17:46 -0400)]
Renamed SourceIdIntoUrl -> SourceIdAsUrl

4 years agoRenames SourceId::into_url -> SourceId::as_url
Hanif Bin Ariffin [Tue, 11 Aug 2020 01:03:53 +0000 (21:03 -0400)]
Renames SourceId::into_url -> SourceId::as_url

While studying the source code, I am surprised to see that `into_url`
does not actually consume the string when a function with such name
usually does. Additionally, there are traits in `cargo::util::IntoUrl`
with the same and does exactly what you expect, consumes T and yields
a `Url`.

I hope this is not too nitpicky.
Thank you!

4 years agoUpdate from review comments.
Eric Huss [Tue, 11 Aug 2020 00:35:34 +0000 (17:35 -0700)]
Update from review comments.

4 years agoTry to fix CI for semver-check.
Eric Huss [Mon, 10 Aug 2020 18:33:42 +0000 (11:33 -0700)]
Try to fix CI for semver-check.

4 years agoDon't check src/doc directory.
Eric Huss [Mon, 10 Aug 2020 18:29:28 +0000 (11:29 -0700)]
Don't check src/doc directory.

4 years agoAdd chapters on dependency resolution and SemVer compatibility.
Eric Huss [Mon, 10 Aug 2020 16:51:22 +0000 (09:51 -0700)]
Add chapters on dependency resolution and SemVer compatibility.

4 years agoAuto merge of #8600 - alexcrichton:deterministic, r=ehuss
bors [Mon, 10 Aug 2020 17:44:43 +0000 (17:44 +0000)]
Auto merge of #8600 - alexcrichton:deterministic, r=ehuss

Build manpage archive deterministically

Keep deterministic builds for Cargo!

Closes #8599

4 years agoBuild manpage archive deterministically
Alex Crichton [Fri, 7 Aug 2020 21:46:15 +0000 (14:46 -0700)]
Build manpage archive deterministically

Keep deterministic builds for Cargo! The changes here are:

* Sort files being added to the archive to ensure they're added in the
  same order on all platforms.
* Flag the archive builder as "deterministic mode" which means it won't
  pick up fields like mtime.

Closes #8599

4 years agoAuto merge of #8604 - jtojnar:patch-1, r=ehuss
bors [Sun, 9 Aug 2020 19:27:31 +0000 (19:27 +0000)]
Auto merge of #8604 - jtojnar:patch-1, r=ehuss

doc: Qualify GNU licenses in example license field

Since SPDX License list 3.0, unqualified GNU licenses are deprecated:

https://www.gnu.org/licenses/identify-licenses-clearly.html

We use version 3.6 of the list so we should not use the deprecated licenses.

4 years agoAuto merge of #8598 - alexcrichton:fix-test, r=ehuss
bors [Sun, 9 Aug 2020 19:05:39 +0000 (19:05 +0000)]
Auto merge of #8598 - alexcrichton:fix-test, r=ehuss

Fix jobserver_exists test on single-cpu systems

Closes #8595

4 years agoFix typo
Eric Huss [Sun, 9 Aug 2020 18:43:52 +0000 (11:43 -0700)]
Fix typo

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
4 years agoAuto merge of #8605 - louib:patch-1, r=ehuss
bors [Sun, 9 Aug 2020 18:42:18 +0000 (18:42 +0000)]
Auto merge of #8605 - louib:patch-1, r=ehuss

Fix small typo in reference/profiles.md

4 years agoFix small typo in reference/profiles.md
louib [Sat, 8 Aug 2020 21:53:21 +0000 (17:53 -0400)]
Fix small typo in reference/profiles.md

4 years agodoc: Qualify GNU licenses in example license field
Jan Tojnar [Sat, 8 Aug 2020 18:38:06 +0000 (20:38 +0200)]
doc: Qualify GNU licenses in example license field

Since SPDX License list 3.0, unqualified GNU licenses are deprecated:

https://www.gnu.org/licenses/identify-licenses-clearly.html

We use version 3.6 of the list so we should not use the deprecated licenses.

4 years agoFix jobserver_exists test on single-cpu systems
Alex Crichton [Fri, 7 Aug 2020 19:50:25 +0000 (12:50 -0700)]
Fix jobserver_exists test on single-cpu systems

Closes #8595

4 years agoAuto merge of #8571 - canova:publish-default, r=ehuss
bors [Thu, 6 Aug 2020 17:48:55 +0000 (17:48 +0000)]
Auto merge of #8571 - canova:publish-default, r=ehuss

Default cargo publish to the alt registry if it's the only allowed one

Hi, this PR fixes #8036. Previously if we had only one allowed registry in Cargo.toml file, `cargo publish` was failing. But with this PR, we are defaulting to the only allowed registry with printing a note if there is only one registry in that array. I believe this will make things easier for people who use an alternative registry all the time.

4 years agoUpdate man page of `cargo publish` to include the new behavior
Nazım Can Altınova [Thu, 6 Aug 2020 11:21:24 +0000 (13:21 +0200)]
Update man page of `cargo publish` to include the new behavior

4 years agoUpdate publish field doc to explain new `cargo publish` behavior
Nazım Can Altınova [Thu, 6 Aug 2020 11:13:02 +0000 (13:13 +0200)]
Update publish field doc to explain new `cargo publish` behavior

4 years agoAdd a test case for new publish behavior change
Nazım Can Altınova [Fri, 31 Jul 2020 00:26:29 +0000 (02:26 +0200)]
Add a test case for new publish behavior change

4 years agoDefault cargo publish to the alt registry if it's the only allowed one
Nazım Can Altınova [Sun, 26 Jul 2020 21:48:25 +0000 (23:48 +0200)]
Default cargo publish to the alt registry if it's the only allowed one

4 years agoFix the comment of Package::publish
Nazım Can Altınova [Fri, 31 Jul 2020 12:59:53 +0000 (14:59 +0200)]
Fix the comment of Package::publish

4 years agoAuto merge of #8565 - pawanbisht62:master, r=ehuss
bors [Wed, 5 Aug 2020 20:31:06 +0000 (20:31 +0000)]
Auto merge of #8565 - pawanbisht62:master, r=ehuss

cargo install with specific yanked version gives confusing "not found" error

Resolves #8171

4 years agoResolve PR comments
bishtpawan [Wed, 5 Aug 2020 15:26:56 +0000 (20:56 +0530)]
Resolve PR comments

4 years agoAuto merge of #8589 - camelid:patch-1, r=alexcrichton
bors [Wed, 5 Aug 2020 14:17:14 +0000 (14:17 +0000)]
Auto merge of #8589 - camelid:patch-1, r=alexcrichton

Fix typo

elswhere -> elsewhere

4 years agoRefactor code and resolve PR comments
bishtpawan [Wed, 5 Aug 2020 12:03:48 +0000 (17:33 +0530)]
Refactor code and resolve PR comments

4 years agoAdd pattern match for yank check and updated corresponding test cases
bishtpawan [Sat, 1 Aug 2020 15:23:24 +0000 (20:53 +0530)]
Add pattern match for yank check and updated corresponding test cases

4 years agoRefactor code
bishtpawan [Sat, 1 Aug 2020 11:27:35 +0000 (16:57 +0530)]
Refactor code

4 years agoAdd test case for yank validation check
bishtpawan [Sat, 1 Aug 2020 11:23:58 +0000 (16:53 +0530)]
Add test case for yank validation check

4 years agoUpdate approach to check for yanked version
bishtpawan [Fri, 31 Jul 2020 06:22:54 +0000 (11:52 +0530)]
Update approach to check for yanked version

4 years agoAdd yank check for package that needs to be download
bishtpawan [Thu, 30 Jul 2020 11:23:26 +0000 (16:53 +0530)]
Add yank check for package that needs to be download

4 years agoFix typo
Camelid [Wed, 5 Aug 2020 01:07:16 +0000 (18:07 -0700)]
Fix typo

4 years agoAuto merge of #8587 - ehuss:close_output-fix, r=alexcrichton
bors [Tue, 4 Aug 2020 23:14:37 +0000 (23:14 +0000)]
Auto merge of #8587 - ehuss:close_output-fix, r=alexcrichton

Fix close_output test.

The close_output test was randomly failing on rust-lang/rust's CI.  This should fix the error. I ran the test in a loop on the rust-lang 16-thread CPU for 10,000 times over the course of 1.5 hours without fail.  The same stress test without this patch failed relatively easily.

I'm a bit on the fence, as this means the test is no longer testing a realistic scenario (the compiler usually doesn't emit a megabyte of diagnostics). Moving this test to a single-threaded runner should also solve the problem. I can't decide if it matters enough to bother.  WDYT?

Closes #8564

4 years agoFix close_output test.
Eric Huss [Tue, 4 Aug 2020 22:50:17 +0000 (15:50 -0700)]
Fix close_output test.

4 years agoAuto merge of #8575 - matthiaskrgr:clippy_v16, r=ehuss
bors [Tue, 4 Aug 2020 03:47:51 +0000 (03:47 +0000)]
Auto merge of #8575 - matthiaskrgr:clippy_v16, r=ehuss

clippy fixes, use matches! macro in more places

4 years agoAuto merge of #8456 - ehuss:embedded-man, r=alexcrichton
bors [Mon, 3 Aug 2020 21:20:46 +0000 (21:20 +0000)]
Auto merge of #8456 - ehuss:embedded-man, r=alexcrichton

Display embedded man pages for built-in commands.

This changes `cargo help COMMAND` to display the man page for the given command.  `cargo COMMAND --help` continues to show the basic clap output.

The man pages are embedded in the executable in a compressed format. There's also a copy of the man pages in text format for platforms that do not have the `man` executable (like Windows).

It is unfortunate to check in more pre-generated files. I hope in the future that the usage of asciidoc can be replaced with something else (possibly a custom markdown-based solution).

cc #6104

4 years agouse sort_by_key() instead of comparing by keys manually
Matthias Krüger [Sat, 1 Aug 2020 11:15:35 +0000 (13:15 +0200)]
use sort_by_key() instead of comparing by keys manually
replace format!() macro by String::from()
use eprintln() instead of manually writing to std::io::stderr

4 years agoChange extract_man to not return a Result (not needed).
Eric Huss [Mon, 6 Jul 2020 16:10:08 +0000 (09:10 -0700)]
Change extract_man to not return a Result (not needed).

4 years agoDisplay embedded man pages for built-in commands.
Eric Huss [Mon, 6 Jul 2020 01:15:07 +0000 (18:15 -0700)]
Display embedded man pages for built-in commands.

4 years agoCreate a dedicated module for help tests.
Eric Huss [Mon, 6 Jul 2020 00:51:22 +0000 (17:51 -0700)]
Create a dedicated module for help tests.

4 years agoAuto merge of #8577 - ehuss:mdman, r=alexcrichton
bors [Mon, 3 Aug 2020 18:37:44 +0000 (18:37 +0000)]
Auto merge of #8577 - ehuss:mdman, r=alexcrichton

Add mdman for generating man pages.

This introduces a new utility called `mdman` that converts a markdown-formatted document to a man page. This replaces asciidoctor, with the intent to make it easier to contribute, easier to have consistent formatting across platforms, and easier to generate plain-text documents for use on Windows (for #8456). This also includes a number of formatting fixes.

There is some documentation in the `mdman/doc` directory explaining how to use it, and the docs in `src/doc/README.md` have been updated (this explains the structure of the files). The Makefile has been replaced with a simple shell script.

CI has been updated to verify the checked-in docs are up-to-date. Perhaps in the future, these can be generated automatically (perhaps by `build.rs`?), but since that requires a bit of build system work (like upstream rust), this is deferred till later.

4 years agoAuto merge of #8581 - toshokan:fix-error-typo, r=Eh2406
bors [Mon, 3 Aug 2020 16:10:33 +0000 (16:10 +0000)]
Auto merge of #8581 - toshokan:fix-error-typo, r=Eh2406

Fix typo 'more then' -> 'more than' in error and comments

There were typos in a reported resolution error and in some comments

4 years agoAuto merge of #8579 - matthiaskrgr:cargo_login_message, r=alexcrichton
bors [Mon, 3 Aug 2020 15:46:14 +0000 (15:46 +0000)]
Auto merge of #8579 - matthiaskrgr:cargo_login_message, r=alexcrichton

cargo login: make login message less ambiguous

The previous message
"please visit https://crates.io/me and paste the API Token below"
Had me waiting for a token to appear in the command line which I would then paste into the website.
Rephrase to
"please paste the api token found on https://crates.io/me below"
to clarify where to paste from and where to paste to.

4 years agoAuto merge of #8578 - ehuss:fix-build-cache-link, r=alexcrichton
bors [Mon, 3 Aug 2020 15:23:11 +0000 (15:23 +0000)]
Auto merge of #8578 - ehuss:fix-build-cache-link, r=alexcrichton

Fix broken link in Build Cache chapter.

4 years agoAuto merge of #8576 - ehuss:fix-broken_intra_doc_links, r=alexcrichton
bors [Mon, 3 Aug 2020 15:00:06 +0000 (15:00 +0000)]
Auto merge of #8576 - ehuss:fix-broken_intra_doc_links, r=alexcrichton

Fix intra-doc tests for renamed lint.

The lint was renamed in https://github.com/rust-lang/rust/pull/74926.

4 years agoFix typo 'more then' -> 'more than' in error and comments
toshokan [Mon, 3 Aug 2020 13:58:39 +0000 (09:58 -0400)]
Fix typo 'more then' -> 'more than' in error and comments

4 years agocargo login: make login message less ambiguous
Matthias Krüger [Sun, 2 Aug 2020 16:04:12 +0000 (18:04 +0200)]
cargo login: make login message less ambiguous

The previous message
"please visit https://crates.io/me and paste the API Token below"
Had me waiting for a token to appear in the command line which I would then paste into the website.
Rephrase to
"please paste the api token found on https://crates.io/me below"
to clarify where to paste from and where to paste to.

4 years agoFix broken link in Build Cache chapter.
Eric Huss [Sun, 2 Aug 2020 00:35:46 +0000 (17:35 -0700)]
Fix broken link in Build Cache chapter.

4 years agoFix some Windows newline behavior.
Eric Huss [Sat, 1 Aug 2020 19:22:14 +0000 (12:22 -0700)]
Fix some Windows newline behavior.

4 years agoDocs, CI, and tools for building man pages.
Eric Huss [Sat, 1 Aug 2020 16:38:43 +0000 (09:38 -0700)]
Docs, CI, and tools for building man pages.

4 years agoRegenerate man pages using mdman.
Eric Huss [Sat, 1 Aug 2020 16:38:02 +0000 (09:38 -0700)]
Regenerate man pages using mdman.

4 years agoRemove old HTML generated man pages.
Eric Huss [Sat, 1 Aug 2020 16:36:24 +0000 (09:36 -0700)]
Remove old HTML generated man pages.

4 years agoReformat asciidoc man pages to markdown.
Eric Huss [Sat, 1 Aug 2020 16:35:24 +0000 (09:35 -0700)]
Reformat asciidoc man pages to markdown.

4 years agoMove asciidoc man pages to markdown.
Eric Huss [Sat, 1 Aug 2020 16:33:06 +0000 (09:33 -0700)]
Move asciidoc man pages to markdown.

4 years agoAdd mdman for generating man pages.
Eric Huss [Sat, 1 Aug 2020 16:13:07 +0000 (09:13 -0700)]
Add mdman for generating man pages.

4 years agoFix intra-doc tests for renamed lint.
Eric Huss [Sat, 1 Aug 2020 16:52:11 +0000 (09:52 -0700)]
Fix intra-doc tests for renamed lint.

4 years agouse matches! macro in more places
Matthias Krüger [Sat, 1 Aug 2020 11:07:35 +0000 (13:07 +0200)]
use matches! macro in more places

4 years agoAuto merge of #8573 - alexcrichton:hash-same, r=ehuss
bors [Fri, 31 Jul 2020 21:56:08 +0000 (21:56 +0000)]
Auto merge of #8573 - alexcrichton:hash-same, r=ehuss

Use the same index location on nightly as beta

Closes #8572

4 years agoUse the same index location on nightly as beta
Alex Crichton [Fri, 31 Jul 2020 15:30:35 +0000 (08:30 -0700)]
Use the same index location on nightly as beta

Closes #8572

4 years agoAuto merge of #8566 - alexcrichton:less-output, r=ehuss
bors [Fri, 31 Jul 2020 03:03:35 +0000 (03:03 +0000)]
Auto merge of #8566 - alexcrichton:less-output, r=ehuss

Don't print to raw stderr in test

Avoids polluting the output of tests with Cargo's build output.

4 years agoAuto merge of #8569 - euclio:deprecation-message, r=ehuss
bors [Fri, 31 Jul 2020 01:43:43 +0000 (01:43 +0000)]
Auto merge of #8569 - euclio:deprecation-message, r=ehuss

relax deprecated diagnostic message check

Needed to unblock rust-lang/rust#74785.

4 years agorelax deprecated diagnostic message check
Andy Russell [Fri, 31 Jul 2020 01:04:22 +0000 (21:04 -0400)]
relax deprecated diagnostic message check

4 years agoAuto merge of #8478 - oli-obk:master, r=alexcrichton
bors [Thu, 30 Jul 2020 14:27:27 +0000 (14:27 +0000)]
Auto merge of #8478 - oli-obk:master, r=alexcrichton

Emit the `test` field in cargo metadata

This is needed so `cargo-metadata` can expose it: https://github.com/oli-obk/cargo_metadata/issues/114

4 years agoDon't print to raw stderr in test
Alex Crichton [Thu, 30 Jul 2020 14:20:43 +0000 (07:20 -0700)]
Don't print to raw stderr in test

Avoids polluting the output of tests with Cargo's build output.

4 years agoEmit the `test` field in cargo metadata
Oliver Scherer [Sun, 12 Jul 2020 14:52:31 +0000 (16:52 +0200)]
Emit the `test` field in cargo metadata

4 years agoAuto merge of #8560 - alexcrichton:o0-for-realz, r=ehuss
bors [Wed, 29 Jul 2020 16:15:05 +0000 (16:15 +0000)]
Auto merge of #8560 - alexcrichton:o0-for-realz, r=ehuss

Fix O0 build scripts by default without `[profile.release]`

This fixes an issue where #8500 didn't quite work as expected, since it
only worked if a crate had a `[profile.release]` section.

4 years agoFix O0 build scripts by default without `[profile.release]`
Alex Crichton [Wed, 29 Jul 2020 13:41:35 +0000 (06:41 -0700)]
Fix O0 build scripts by default without `[profile.release]`

This fixes an issue where #8500 didn't quite work as expected, since it
only worked if a crate had a `[profile.release]` section.

4 years agoAuto merge of #8561 - icorbrey:git-dep-lock-docs, r=ehuss
bors [Wed, 29 Jul 2020 14:58:31 +0000 (14:58 +0000)]
Auto merge of #8561 - icorbrey:git-dep-lock-docs, r=ehuss

Emphasize git dependency version locking behavior.

Added a section in `src/doc/src/reference/specifying-dependencies.md` clarifying Cargo's version locking behavior when adding `git` dependencies:

```
Once a `git` dependency has been added, Cargo will lock that dependency to the
latest commit at the time. New commits will not be pulled down automatically
once the lock is in place. However, they can be pulled down manually with
`cargo update`.
```

Resolves #8555

4 years agoAuto merge of #8554 - alexcrichton:update-lockfile-rollout, r=ehuss
bors [Wed, 29 Jul 2020 14:34:30 +0000 (14:34 +0000)]
Auto merge of #8554 - alexcrichton:update-lockfile-rollout, r=ehuss

Update lock file encodings on changes

This commit alters Cargo's lockfile encoding update strategy from its
previous incarnation. Previously Cargo had two versions, one for new
lock files and one for old lock files. Each of these versions were
different and would affect how Cargo manages lock file updates. The
intention was that we'd roll out defaults to new lock files first and
then later to preexisting lock files. This requires two separate
changes, though, and it's not necessarily clear when to start updating
old lock files. Additionally when old lock files were opted in it would
break builds using `--locked` if they simply updated Cargo because Cargo
would would want to bring the lock file versions forward.

The purpose of this change is to solve these issues. The new strategy
for updating a lock file's encoding is to simply preserve what's already
existing on the filesystem until we actually decide to write out a new
lock file. When Cargo updates a lock file on-disk then it will, at that
time, update the lock file encoding to whatever the current default is.
This means that there's only one version number to keep track of (the
default for encoding). Cargo will always preserve the preexisting
encoding unless another change is required to the lock file.

4 years agoAuto merge of #8559 - ehuss:fix-lto-tests-flaky, r=alexcrichton
bors [Wed, 29 Jul 2020 14:02:16 +0000 (14:02 +0000)]
Auto merge of #8559 - ehuss:fix-lto-tests-flaky, r=alexcrichton

Fix sporadic lto test failures.

These tests can fail because the order of the messages is not deterministic.  The two `foo` jobs start in parallel, so the order can be swapped.  Results in an error like:

```
---- lto::test_profile stdout ----
running `/home/runner/work/cargo/cargo/target/debug/cargo test -v`
thread 'lto::test_profile' panicked at '
Expected: execs
    but: differences:
  6 - |[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no[..]|
    + |     Running `rustc --crate-name foo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C lto=thin -C debuginfo=2 --test -C metadata=af771ad588185fac -C extra-filename=-af771ad588185fac --out-dir /home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps -L dependency=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps --extern bar=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps/libbar-398704963dd4e38b.rlib`|

  7 - |[RUNNING] `rustc --crate-name foo [..]--emit=dep-info,link -C lto=thin [..]--test[..]|
    + |     Running `rustc --crate-name foo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=1e8f5d385f4ffeb6 -C extra-filename=-1e8f5d385f4ffeb6 --out-dir /home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps -L dependency=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps --extern bar=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps/libbar-398704963dd4e38b.rmeta`|
```

The failure rate is pretty small (depends heavily on the hardware).

4 years agofix: Emphasize git dependency version locking behavior.
Isaac Corbrey [Wed, 29 Jul 2020 13:49:44 +0000 (04:49 -0900)]
fix: Emphasize git dependency version locking behavior.

4 years agoAuto merge of #8558 - JohnTitor:fix-build-std, r=alexcrichton
bors [Wed, 29 Jul 2020 13:40:14 +0000 (13:40 +0000)]
Auto merge of #8558 - JohnTitor:fix-build-std, r=alexcrichton

build-std: Fix libraries paths following upstream

Fixes #8557

4 years agoFix sporadic lto test failures.
Eric Huss [Wed, 29 Jul 2020 05:25:45 +0000 (22:25 -0700)]
Fix sporadic lto test failures.

4 years agoFix mock-std as well
Yuki Okushi [Wed, 29 Jul 2020 03:41:43 +0000 (12:41 +0900)]
Fix mock-std as well

4 years agoFix libraries paths following upstream
Yuki Okushi [Wed, 29 Jul 2020 03:20:51 +0000 (12:20 +0900)]
Fix libraries paths following upstream

4 years agoAuto merge of #8553 - alexcrichton:more-maybe-spurious, r=ehuss
bors [Tue, 28 Jul 2020 19:33:38 +0000 (19:33 +0000)]
Auto merge of #8553 - alexcrichton:more-maybe-spurious, r=ehuss

Flag git http errors as maybe spurious

This showed up in #8544 with an error message of "stream ended at an
unexpected time; class=Http" which sounds like a spurious error.
Termination of a network connection can happen at any time! For now try
to assist in that error by adding another class of error to the list of
maybe spurious errors.

4 years agoUpdate lock file encodings on changes
Alex Crichton [Tue, 28 Jul 2020 19:17:55 +0000 (12:17 -0700)]
Update lock file encodings on changes

This commit alters Cargo's lockfile encoding update strategy from its
previous incarnation. Previously Cargo had two versions, one for new
lock files and one for old lock files. Each of these versions were
different and would affect how Cargo manages lock file updates. The
intention was that we'd roll out defaults to new lock files first and
then later to preexisting lock files. This requires two separate
changes, though, and it's not necessarily clear when to start updating
old lock files. Additionally when old lock files were opted in it would
break builds using `--locked` if they simply updated Cargo because Cargo
would would want to bring the lock file versions forward.

The purpose of this change is to solve these issues. The new strategy
for updating a lock file's encoding is to simply preserve what's already
existing on the filesystem until we actually decide to write out a new
lock file. When Cargo updates a lock file on-disk then it will, at that
time, update the lock file encoding to whatever the current default is.
This means that there's only one version number to keep track of (the
default for encoding). Cargo will always preserve the preexisting
encoding unless another change is required to the lock file.

4 years agoAuto merge of #8542 - CPerezz:aliases, r=ehuss
bors [Tue, 28 Jul 2020 19:09:02 +0000 (19:09 +0000)]
Auto merge of #8542 - CPerezz:aliases, r=ehuss

Display builtin aliases with `cargo --list`

As stated in #8486 it would help to the discovery of the
builtin aliases the facto of printing them with the
`cargo --list` command.

- Extracted the builtin aliases currently implemented to a
separated `const`.
- Make all of the functions that interact with these aliases
point to that function.
- Refactored the `list_commands` fn in order to include with the
builtin and external commands, the builtin aliases that come with
cargo by default.
- Added a test that checks that the aliases that currently
are builtin with cargo are indeed being printed with the rest
of the commands when `cargo --list` is called.

The output on my machine looks like this:
```
$ cargo --list
Installed Commands:
    b                    alias: build
    bench                Execute all benchmarks of a local package
    build                Compile a local package and all of its dependencies
    c                    alias: check
    check                Check a local package and all of its dependencies for errors
    clean                Remove artifacts that cargo has generated in the past
    doc                  Build a package's documentation
    fetch                Fetch dependencies of a package from the network
    fix                  Automatically fix lint warnings reported by rustc
    generate-lockfile    Generate the lockfile for a package
    git-checkout         This subcommand has been removed
    init                 Create a new cargo package in an existing directory
    install              Install a Rust binary. Default location is $HOME/.cargo/bin
    locate-project       Print a JSON representation of a Cargo.toml file's location
    login                Save an api token from the registry locally. If token is not specified, it will be read from stdin.
    metadata             Output the resolved dependencies of a package, the concrete used versions including overrides, in machine-readable format
    new                  Create a new cargo package at <path>
    owner                Manage the owners of a crate on the registry
    package              Assemble the local package into a distributable tarball
    pkgid                Print a fully qualified package specification
    publish              Upload a package to the registry
    r                    alias: run
    read-manifest        Print a JSON representation of a Cargo.toml manifest.
    run                  Run a binary or example of the local package
    rustc                Compile a package, and pass extra options to the compiler
    rustdoc              Build a package's documentation, using specified custom flags.
    search               Search packages in crates.io
    t                    alias: test
    test                 Execute all unit and integration tests and build examples of a local package
    tree                 Display a tree visualization of a dependency graph
    uninstall            Remove a Rust binary
    update               Update dependencies as recorded in the local lock file
    vendor               Vendor all dependencies for a project locally
    verify-project       Check correctness of crate manifest
    version              Show version information
    yank                 Remove a pushed crate from the index
    clippy
    clippy
    clippy
    clippy
    flamegraph
    fmt
    fmt
    fmt
    fmt
    miri
    miri
    miri
    miri
    outdated
    tree
```

As discussed with @ehuss the `BTreeSet` enforces `Ord` therefore, the aliases get mixed with the commands since they're passed through the same function.

It can be refactored to appear separately, but, the code will be more spread and now it's all in just one file (which I believe is easier to maintain and review).

Closes #8486

4 years agoRemomve builtin_aliases duplicate declaration
CPerezz [Tue, 28 Jul 2020 18:53:59 +0000 (20:53 +0200)]
Remomve builtin_aliases duplicate declaration

As @ehuss correctly suggested, we could just declare
in one `const` structure for every builtin alias the
following: `(alias, aliased_command, description)`.

Therefore, the suggestion has been applied and the
`BUILTIN_ALIASES` const has been refactored.

Also, the `builtin_aliases_execs` now parses the
`BUILTIN_ALIASES` const searching for a
"possible alias command" returning an option with the
previous info structure or `None`.

4 years agoAuto merge of #7950 - aleksator:4854_non_existent_features_error, r=ehuss
bors [Tue, 28 Jul 2020 18:44:20 +0000 (18:44 +0000)]
Auto merge of #7950 - aleksator:4854_non_existent_features_error, r=ehuss

Check manifest for requiring nonexistent features

Fixes #4854: Examples requiring a nonexistent feature should be an error

Thanks @lukaslueg with his https://github.com/rust-lang/cargo/pull/4874 for the inspiration!

4 years agoFlag git http errors as maybe spurious
Alex Crichton [Tue, 28 Jul 2020 18:33:10 +0000 (11:33 -0700)]
Flag git http errors as maybe spurious

This showed up in #8544 with an error message of "stream ended at an
unexpected time; class=Http" which sounds like a spurious error.
Termination of a network connection can happen at any time! For now try
to assist in that error by adding another class of error to the list of
maybe spurious errors.

4 years agoAuto merge of #8552 - icorbrey:test-name-filtering-docs, r=ehuss
bors [Tue, 28 Jul 2020 18:19:53 +0000 (18:19 +0000)]
Auto merge of #8552 - icorbrey:test-name-filtering-docs, r=ehuss

Clarify test name filter usage

I set aside the description of the usage example in the top description section and added a more concise example in the example section at the bottom of the man page. I also changed the wording of the usage example up top a bit to be more search-friendly since "filter" is a common keyword to search for.

Resolves #8282

4 years agoRebuild generated man pages.
Eric Huss [Tue, 28 Jul 2020 18:18:02 +0000 (11:18 -0700)]
Rebuild generated man pages.

4 years agofix: Clarify test name filter usage
Isaac Corbrey [Tue, 28 Jul 2020 14:19:58 +0000 (05:19 -0900)]
fix: Clarify test name filter usage

Set aside description of the usage example in the top description section and added a more consise example in the example section at the bottom of the man page.

4 years agoAuto merge of #8551 - CPerezz:manifest_edition_nit, r=Eh2406
bors [Tue, 28 Jul 2020 13:19:16 +0000 (13:19 +0000)]
Auto merge of #8551 - CPerezz:manifest_edition_nit, r=Eh2406

Revert Cargo Book changes for default edition

On #8543 it was introduced a change on the Cargo Book docs
where it was incorrectly stated that the default edition for
the Cargo Manifest was `2018` when indeed, as @ehuss correctly stated
in https://github.com/rust-lang/cargo/pull/8543#issuecomment-663769077
it is not.

Therefore, as @Eh2406 asked for, I made the PR reverting this changes
and leaving the Cargo Book docs as they were before.

4 years agoRevert Cargo Book changes for default edition
CPerezz [Tue, 28 Jul 2020 10:39:22 +0000 (12:39 +0200)]
Revert Cargo Book changes for default edition

On #8543 it was introduced a change on the Cargo Book docs
where it was incorrectly stated that the default edition for
the Cargo Manifest was `2018` when indeed, as @ehuss correctly stated
in https://github.com/rust-lang/cargo/pull/8543#issuecomment-663769077
it is not.

Therefore, as @Eh2406 asked for, I made the PR reverting this changes
and leaving the Cargo Book docs as they were before.

4 years agoAuto merge of #8522 - alexcrichton:revert-master, r=ehuss
bors [Mon, 27 Jul 2020 18:20:05 +0000 (18:20 +0000)]
Auto merge of #8522 - alexcrichton:revert-master, r=ehuss

Prepare for not defaulting to master branch for git deps

This PR is the "equivalent" of https://github.com/rust-lang/cargo/pull/8503 for the nightly channel of Rust (the master branch of Cargo). The purpose of this change is to fix the breakage from https://github.com/rust-lang/cargo/pull/8364 but to still pave a path forward to enabling the feature added in https://github.com/rust-lang/cargo/pull/8364, namely reinterpreting dependency directives without a `branch` directive as depending on `HEAD` insead of depending on `master`.

This is a series of commits which implements a few mitigation strategies, but they're all adding up into a larger plan to roll out this change with, ideally, no breaking changes for those "reasonably" keeping up with Rust. The changes here are:

* Cargo still internally differentiates between `DefaultBranch` and `Branch("master")`, so it knows what you wrote in the manifest. These two, however, hash and equate together so everything in Cargo considers them equivalent.
* Cargo will now issue a warning whenever it fetches a repository pinned to `DefaultBranch` and the branch's `master` branch doesn't actually match `HEAD`. This avenue of breakage didn't arise but I added it here for completionism about not having to deal with breakage from this change again.
* Cargo has now implemented a new future lockfile format. Internally this is dubbed "v3". The changes in this format is that it will have a `version` marker at the top of the file as well as encoding git dependencies different. Today `DefaultBranch` and `Branch("master")` encode the same way, but in the future they will encode differently.
* Cargo now has a warning where if you have a mixture of `DefaultBranch` and `Branch("master")` in your build. The intention here is to get everyone on one or the other so the transition to the new lock file format can go smoothly.

With all of these pieces in place the intention is that there is no breakage from #8364 as well. Additionally projects that *would* break will receive warnings. (note that projects "broken" today, those we've got issues for, will likely not get warnings, but that's because it was accidental we broke them). The long-term plan is to let this bake for quite some time, and then as part of the same change land an update to the new lock file format as well as "fixing" `SourceId` to consider these two directives different. When this change happens we should have guaranteed, for all currently active projects, they're either only using `branch = "master"` or no directive at all. We can therefore unambiguosly read the previous `Cargo.lock` to transition it into a new `Cargo.lock` which will either have `?branch=master` or nothing.

I'm not sure how long this will need to bake for because unfortunately version changes to `Cargo.lock` cannot be taken lightly. We haven't even bumped the default format for old lock files to `V2` yet, they're still on `V1`. Hopefully in getting this in early-ish, though, we can at least get the ball rolling.

Closes #8468

4 years agoAuto merge of #8547 - ThePuzzlemaker:patch-1, r=ehuss
bors [Mon, 27 Jul 2020 14:32:42 +0000 (14:32 +0000)]
Auto merge of #8547 - ThePuzzlemaker:patch-1, r=ehuss

Include `+` for crates.io feature requirements in the Cargo Book section on features

This change was introduced in commit 5f842f7 of rust-lang/crates.io but was not subsequently added to the Cargo Book.

4 years agoInclude `+` for crates.io feature requirements
James [Mon, 27 Jul 2020 06:58:55 +0000 (01:58 -0500)]
Include `+` for crates.io feature requirements

This change was introduced in commit 5f842f7 of rust-lang/crates.io.

4 years agoWarn on missing required-features
Alex Tokarev [Fri, 28 Feb 2020 18:55:18 +0000 (21:55 +0300)]
Warn on missing required-features

Co-authored-by: Eric Huss <eric@huss.org>
4 years agoAuto merge of #8540 - vandenheuvel:update_termcolor_version, r=ehuss
bors [Sat, 25 Jul 2020 17:00:56 +0000 (17:00 +0000)]
Auto merge of #8540 - vandenheuvel:update_termcolor_version, r=ehuss

Update termcolor and fwdansi versions

A summary of the changes since 1.0.5:

- **wincolor-1.0.3**
- readme: update readme with various things
- ci: switch to GitHub Actions and bump MSRV to 1.34.0
- doc: add notes about tty detection
- doc: clarify how ANSI colors work
- **env: respect NO_COLOR environment variable**
- edition: switch to Rust 2018
- deps: drop wincolor dependency
- msrv: document minimum supported Rust version policy
- style: use rustfmt
- **api: add option to toggle terminal resetting**
- readme: test examples in README
- **bug: fix clear() and is_none()**
- **output: italicized support**
- **wincolor-1.0.2**
- wincolor: specify dual-license