]> git.proxmox.com Git - cargo.git/log
cargo.git
3 years agoAllow LinkType to access the Target for checking if it applies.
Dario Nieuwenhuis [Tue, 11 May 2021 22:21:35 +0000 (00:21 +0200)]
Allow LinkType to access the Target for checking if it applies.

3 years agoAuto merge of #9493 - ehuss:contrib-git-url, r=alexcrichton
bors [Tue, 18 May 2021 21:48:52 +0000 (21:48 +0000)]
Auto merge of #9493 - ehuss:contrib-git-url, r=alexcrichton

Add GitHub link to contributor guide.

This adds a small icon on each page that links back to the GitHub source.

3 years agoAuto merge of #9498 - ehuss:rustup-windows-workaround, r=alexcrichton
bors [Tue, 18 May 2021 20:47:05 +0000 (20:47 +0000)]
Auto merge of #9498 - ehuss:rustup-windows-workaround, r=alexcrichton

Add temporary fix for rustup on windows in CI.

This adds a temporary fix for rustup on the Windows CI runners. The GitHub image updated to rustup 1.24.1 which has an issue (https://github.com/rust-lang/rustup/issues/2759) causing them to fail.  This is fixed in 1.24.2.  I believe the images are updated on roughly a weekly basis, and from what I can see the image just downloads the most recently release, so hopefully this will be fixed on GitHub's side in roughly a week. Until then, this will force rustup to update.

Note: Self updates aren't available on macOS images, but they seem to work on the others.

3 years agoAdd temporary fix for rustup on windows in CI.
Eric Huss [Tue, 18 May 2021 20:32:04 +0000 (13:32 -0700)]
Add temporary fix for rustup on windows in CI.

3 years agoAuto merge of #9495 - dunkyl:master, r=ehuss
bors [Tue, 18 May 2021 14:05:33 +0000 (14:05 +0000)]
Auto merge of #9495 - dunkyl:master, r=ehuss

3 typos and some capitalization

3 typos and...

Most of the docs use "command-line" instead of "commandline", changed where it made sense (in plain text).

Most of the docs also use "SemVer" instead of "semver", changed for consistency except for the "semver trick" (consistent with context).

I believe these are the correct files to change, since none of these changes are in doc/man?

3 years agoCapitalization
dunkyl [Tue, 18 May 2021 05:49:50 +0000 (22:49 -0700)]
Capitalization

SemVer

Rust capitalization

3 years agotypo
dunkyl [Tue, 18 May 2021 05:49:17 +0000 (22:49 -0700)]
typo

3 years agodash-style command-line
dunkyl [Tue, 18 May 2021 05:18:10 +0000 (22:18 -0700)]
dash-style command-line

3 years ago2 typos
dunkyl [Tue, 18 May 2021 05:17:31 +0000 (22:17 -0700)]
2 typos

3 years agoAdd GitHub link to contributor guide.
Eric Huss [Mon, 17 May 2021 21:52:37 +0000 (14:52 -0700)]
Add GitHub link to contributor guide.

3 years agoAuto merge of #9484 - kklibo:master, r=ehuss
bors [Fri, 14 May 2021 00:59:52 +0000 (00:59 +0000)]
Auto merge of #9484 - kklibo:master, r=ehuss

fix 6 typos

Fixes #9483

3 years agofix 6 typos
kklibo [Fri, 14 May 2021 00:36:02 +0000 (17:36 -0700)]
fix 6 typos

3 years agoAuto merge of #9468 - PaulDance:fix-rustdoc-warnings, r=ehuss
bors [Tue, 11 May 2021 18:12:23 +0000 (18:12 +0000)]
Auto merge of #9468 - PaulDance:fix-rustdoc-warnings, r=ehuss

Fix rustdoc warnings

Change some small parts of the unit documentation in order to resolve warnings emitted when running `cargo doc` from the root of this project. It should help reduce the noise when checking that new or updated documentation builds correctly.

See the commit messages for details about the modifications themselves, although they should be rather simple.

Cheers,
Paul.

3 years agoAuto merge of #9478 - ehuss:faster-git-status, r=alexcrichton
bors [Tue, 11 May 2021 14:22:21 +0000 (14:22 +0000)]
Auto merge of #9478 - ehuss:faster-git-status, r=alexcrichton

Improve performance of git status check in `cargo package`.

The check for a dirty repository during packaging/publishing is quite slow. It was calling `status_file` for every packaged file, which is very expensive. I have a directory that had about 10,000 untracked files. Previously, cargo would hang for over 2 minutes without any output. With this PR, it finishes in 0.3 seconds.

The solution here is to collect the status information once, and then compare the package list against it.

One subtle point is that it does not use `recurse_untracked_dirs`, and instead relies on a primitive `starts_with` comparison, which I believe should be equivalent.

This still includes an inefficient n^2 algorithm, but I am too lazy to make a better approach.

I'm moderately confident this is pretty much the same as before (at least, all the scenarios I could think of).

3 years agoImprove performance of git status check in `cargo package`.
Eric Huss [Tue, 11 May 2021 01:15:05 +0000 (18:15 -0700)]
Improve performance of git status check in `cargo package`.

3 years agoAuto merge of #9477 - ehuss:link-test-chapter, r=alexcrichton
bors [Mon, 10 May 2021 23:32:46 +0000 (23:32 +0000)]
Auto merge of #9477 - ehuss:link-test-chapter, r=alexcrichton

Link to the new rustc tests chapter.

There's a new chapter in the rustc book on how the libtest harness works, and the command-line options it offers. This adds a few links to that new chapter in the cargo book.

3 years agoAuto merge of #9476 - ehuss:index-cache-bump, r=alexcrichton
bors [Mon, 10 May 2021 23:04:32 +0000 (23:04 +0000)]
Auto merge of #9476 - ehuss:index-cache-bump, r=alexcrichton

Bump index cache version to deal with semver metadata version mismatch.

#9467 has uncovered an issue with how versions are handled in the index cache.  When using a debug build of Cargo, it may panic due to the [cache contents changing](https://github.com/rust-lang/cargo/blob/5c455130b6001c7f54e872e161c27f6e996aff1f/src/cargo/sources/registry/index.rs#L606-L619).  The particular problem I am running into is that the index has an entry for `openssl-src 110.0.0` and `110.0.0+1.1.0f`. This is due to an issue with crates.io where it allows publishing multiple versions with the same metadata (https://github.com/rust-lang/crates.io/issues/1059).  Cargos before #9467 would populate the index cache with two entries, both with version `110.0.0`.  Afterwards, there are two separate entries (`110.0.0` and `110.0.0+1.1.0f`).

The change here is to bump the index cache version so that new versions of cargo will clear the cache, and won't trigger the assertion.

This may be a bit of a heavy-handed solution, as I think this only affects debug builds of cargo.  However, I instantly started running into this problem, so I suspect it will be a real annoyance for anyone developing cargo. Happy to discuss other possible solutions.

3 years agoLink to the new rustc tests chapter.
Eric Huss [Thu, 22 Apr 2021 00:37:12 +0000 (17:37 -0700)]
Link to the new rustc tests chapter.

3 years agoBump index cache version.
Eric Huss [Mon, 10 May 2021 22:15:26 +0000 (15:15 -0700)]
Bump index cache version.

3 years agoAuto merge of #9475 - PaulDance:fix-test-support-warning, r=ehuss
bors [Mon, 10 May 2021 21:39:52 +0000 (21:39 +0000)]
Auto merge of #9475 - PaulDance:fix-test-support-warning, r=ehuss

Fix Url::into_string deprecation warning

```rust
warning: use of deprecated associated function `url::Url::into_string`: use Into<String>
   --> src/registry.rs:183:26
    |
183 |                 dl_url().into_string(),
    |                          ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
```

is being emitted when running `cargo build` directly from the `crates/cargo-test-support` or the `crates/mdman` crate. This simply proposes a switch to the recommended method in order to resolve the deprecation warning.

3 years agoBump `url` to 2.2.2 where `Into<String>` for `Url` is used
Paul Mabileau [Mon, 10 May 2021 20:20:11 +0000 (22:20 +0200)]
Bump `url` to 2.2.2 where `Into<String>` for `Url` is used

The base package, `cargo-test-support` and `mdman`.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix Url::into_string deprecation warning
Paul Mabileau [Mon, 10 May 2021 17:51:02 +0000 (19:51 +0200)]
Fix Url::into_string deprecation warning

`url::Url::into_string` is deprecated. The `Into<String>` implementation
is now used.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoAuto merge of #9469 - PaulDance:fossil-local-settings, r=ehuss
bors [Mon, 10 May 2021 17:26:27 +0000 (17:26 +0000)]
Auto merge of #9469 - PaulDance:fossil-local-settings, r=ehuss

Fix #4482 and #9449: set Fossil ignore and clean settings locally

This aims to close #4482 and close #9449.

Context: currently, the Fossil extension for `cargo new` would call `fossil settings [...]` in order to configure the created repository to ignore and allow cleaning the `target` build directory. However, as #9449 shows, it is ran from the CWD, which is probably outside of the repo, therefore it modifies global settings instead of local ones. This PR fixes that by writing the settings to local versioned files as the issue recommends.

Furthermore, as #9449 notes, configuring the repository's ignore settings only in `util::vcs::FossilRepo::init` means it is not done when the repository is not new and makes it harder to maintain equivalent support for VCS ignore system implementations. It also completely ignores the `--lib` CLI option which adds `Cargo.lock` to the ignore list for Git and Mercurial.

Therefore, the following modifications have been performed, using [the Fossil documentation](https://fossil-scm.org/home/doc/trunk/www/globs.md) as a reference for the ignore syntax:

 * All settings logic has been removed from `FossilRepo::init`.
 * `ops::cargo_new::IgnoreList::push` now requires a third argument for Fossil-specific glob syntax that is stored in a new `fossil_ignore` field.
 * `IgnoreList::format_new` uses the `fossil_ignore` field when needed just like any other VCS.
 * `IgnoreList::format_existing` handles Fossil separately for a few operations as its glob syntax does not support comments, so any lines starting with `#` cannot be included: the configurations can only be merged here.
 * `write_ignore_file` has been modified a bit as well to enable writing to two files for Fossil specifically in order to keep supporting its cleaning feature. The return type of the function is now `CargoResult<()>` instead `CargoResult<String>`: it makes the implementation easier and as the return value was actually not used, I figured it would be okay to do so, plus that return value would not make too much sense anymore for Fossil because of the two possibly different file contents.
 * `mk` has been updated to provide the correct ignore glob to `IgnoreList::push` for Fossil.

3 years agoAuto merge of #9472 - r00ster91:bettererrors, r=alexcrichton
bors [Mon, 10 May 2021 15:35:17 +0000 (15:35 +0000)]
Auto merge of #9472 - r00ster91:bettererrors, r=alexcrichton

Improve two error messages

The first error message saying "an integer" is confusing because if you give it `4` it's an integer but it will still complain that it must be an integer. So it's more specific now and tells you that it actually needs to be `1`, `2` or `3`.
In the second error there was a space missing. It says `is not a valid setting,must be`.

3 years agoImprove two error messages
r00ster91 [Mon, 10 May 2021 15:28:19 +0000 (17:28 +0200)]
Improve two error messages

3 years agoAuto merge of #9467 - ehuss:install-metadata, r=alexcrichton
bors [Mon, 10 May 2021 13:47:40 +0000 (13:47 +0000)]
Auto merge of #9467 - ehuss:install-metadata, r=alexcrichton

Fix `cargo install` with a semver metadata version.

This fixes an issue where `cargo install cargo-c --version 0.8.0+cargo-0.51` fails (returns a 404 error when downloading) when the index has not yet been populated through other means. The crux of the issue is that the `PackageId` interner was treating `0.8.0+cargo-0.51` and `0.8.0` the same. Due to a chain of events, the interner was getting populated with `0.8.0` first, and then from there on always returned `0.8.0`. The full version information is needed to construct the download URL, so it was failing.

The reason the interner was getting populated with a version without the metadata is the following sequence of events:

1. There is [this "fast path" code path](https://github.com/rust-lang/cargo/blob/d1baf0d81d0e4f91881de8e544c71fb49f623047/src/cargo/ops/cargo_install.rs#L570) which checks if a version of a package is already installed *before updating the index*.
2. Since the index doesn't exist yet, the resolver query returns zero entries (because the Registry Source is empty) [here](https://github.com/rust-lang/cargo/blob/d1baf0d81d0e4f91881de8e544c71fb49f623047/src/cargo/ops/common_for_install_and_uninstall.rs#L546-L550).
3. That code checks if the package has been yanked (because it can't tell the difference between "yanked" and "index not downloaded, yet").
4. It constructs a `PackageId` using a `VersionReq` where the build metadata has been removed (because version reqs don't have build metadata).
5. When the real install continues (the error here is ignored for the purpose of this fast-path check if it is already installed), it downloads the index. However, the `PackageId` values created when parsing the index JSON files are now missing the build metadata because the interner is returning the wrong entries.
6. When the download starts, the URL is built from the `PackageId` missing the build metadata.

I only changed `PackageIdInner` to pay attention to the build metadata. This seems a bit fragile, as perhaps `PackageId` should also pay attention to it. However, I don't really want to do an audit of every use of `PackageId`, and offhand I can't think of other situations where it would matter.

Closes #9410

3 years agoSet Fossil ignore and clean settings locally
Paul Mabileau [Sun, 9 May 2021 20:13:55 +0000 (22:13 +0200)]
Set Fossil ignore and clean settings locally

Previously, the Fossil extension for `cargo new` would call `fossil
settings [...]` in order to configure the created repository to ignore
and allow cleaning the `target` build directory. However, as #9449
shows, it is ran from the CWD, which is probably outside of the repo,
therefore it modifies global settings instead of local ones. This aims
to fix that by writing the settings to local versioned files as the
issue recommends.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix doc warnings for cargo-util::paths
Paul Mabileau [Sun, 9 May 2021 17:47:08 +0000 (19:47 +0200)]
Fix doc warnings for cargo-util::paths

Add parentheses to disambiguate from `write!`.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoResolve doc warnings for RegistryData
Paul Mabileau [Sun, 9 May 2021 17:37:13 +0000 (19:37 +0200)]
Resolve doc warnings for RegistryData

Specify `Self::finish_download` instead of just `finish_download` and
link to `crate::core::package::Downloads` instead of `Download` as
`Downloads` is the public one, does the actual stuff and `Download` only
stores data.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix rustdoc warnings for RegistrySource and RegistryData
Paul Mabileau [Sun, 9 May 2021 17:25:45 +0000 (19:25 +0200)]
Fix rustdoc warnings for RegistrySource and RegistryData

Inline the link targets directly in the text.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoRemove rustdoc warnings for core::features
Paul Mabileau [Sun, 9 May 2021 17:14:52 +0000 (19:14 +0200)]
Remove rustdoc warnings for core::features

Link `CliUnstable::add` just to `CliUnstable` instead.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix `cargo install` with a semver metadata version.
Eric Huss [Sat, 8 May 2021 23:31:09 +0000 (16:31 -0700)]
Fix `cargo install` with a semver metadata version.

3 years agoAuto merge of #9375 - vojtechkral:tests-target-dir, r=ehuss
bors [Fri, 7 May 2021 21:29:52 +0000 (21:29 +0000)]
Auto merge of #9375 - vojtechkral:tests-target-dir, r=ehuss

Add CARGO_TARGET_TMPDIR env var for integration tests & benches

Hi.
Recently I [ran into](https://github.com/vojtechkral/bard/blob/main/tests/util/mod.rs#L32) the problem that integration tests don't have a good way to figure out where `target` dir is.

Knowing where `target` is is useful for integration tests that need to setup some filesystem structure for test cases. In fact `cargo` itself does this too (and figures out the path rather clumsily).

Another popular way of doing this is to create a directory in `/tmp` (or quivalent on other systems), however, I believe using subdirectory in `target` is better as testcases are easier to debug that way and temporary  locations aren't polluted.

I think this would also address some concerns in #2841

Another solution might be to provide a dedicated subdirectory in `target` for this, something like `target/scratchpad`, but I'm not convinced this is warranted... Edit: That's what was decided to do, see below...

Let me know what you think :slightly_smiling_face:

3 years agoAuto merge of #9464 - ehuss:version-bump, r=Eh2406
bors [Fri, 7 May 2021 18:59:28 +0000 (18:59 +0000)]
Auto merge of #9464 - ehuss:version-bump, r=Eh2406

Bump to 0.55.0, update changelog

3 years agoUpdate changelog for 1.53
Eric Huss [Fri, 7 May 2021 16:00:22 +0000 (09:00 -0700)]
Update changelog for 1.53

3 years agoBump to 0.55.0
Eric Huss [Fri, 7 May 2021 15:10:28 +0000 (08:10 -0700)]
Bump to 0.55.0

3 years agoUse CARGO_TARGET_TMPDIR in integration tests if available
Vojtech Kral [Thu, 6 May 2021 21:12:28 +0000 (23:12 +0200)]
Use CARGO_TARGET_TMPDIR in integration tests if available

3 years agoAdd CARGO_TARGET_TMPDIR env var for integration tests & benches
Vojtech Kral [Thu, 6 May 2021 21:04:52 +0000 (23:04 +0200)]
Add CARGO_TARGET_TMPDIR env var for integration tests & benches

The variable is set to $target_dir/$config/tmp
This is a directory where tests & benches can place testcasei-related data
for use by the tests.
cargo makes sure the directory exists when building tests/benches.

3 years agoAuto merge of #9457 - ehuss:unstable-doc-updates, r=alexcrichton
bors [Wed, 5 May 2021 14:04:05 +0000 (14:04 +0000)]
Auto merge of #9457 - ehuss:unstable-doc-updates, r=alexcrichton

Some updates to the unstable documentation

* Extends the future-incompat docs.
* Adds `cargo rustc --print`
* Adds a table of contents.  The chapter is really long and unorganized, so I hope this can maybe help make things easier to discover.

3 years agoAdd a TOC to the unstable chapter.
Eric Huss [Tue, 4 May 2021 16:24:11 +0000 (09:24 -0700)]
Add a TOC to the unstable chapter.

3 years agoAdd `cargo rustc --print` unstable docs.
Eric Huss [Tue, 4 May 2021 15:55:23 +0000 (08:55 -0700)]
Add `cargo rustc --print` unstable docs.

3 years agoElaborate a little on future-incompat unstable docs.
Eric Huss [Tue, 4 May 2021 15:51:57 +0000 (08:51 -0700)]
Elaborate a little on future-incompat unstable docs.

3 years agoSome cleanup.
Eric Huss [Tue, 4 May 2021 15:50:41 +0000 (08:50 -0700)]
Some cleanup.

3 years agoAuto merge of #9456 - ehuss:env-split-debuginfo, r=alexcrichton
bors [Tue, 4 May 2021 15:40:22 +0000 (15:40 +0000)]
Auto merge of #9456 - ehuss:env-split-debuginfo, r=alexcrichton

Add CARGO_PROFILE_<name>_SPLIT_DEBUGINFO to env docs.

I forgot this needed to be updated.

3 years agoAdd CARGO_PROFILE_<name>_SPLIT_DEBUGINFO to env docs.
Eric Huss [Tue, 4 May 2021 13:12:57 +0000 (06:12 -0700)]
Add CARGO_PROFILE_<name>_SPLIT_DEBUGINFO to env docs.

3 years agoRemove trailing spaces.
Eric Huss [Tue, 4 May 2021 13:11:42 +0000 (06:11 -0700)]
Remove trailing spaces.

3 years agoAuto merge of #9438 - ehuss:report-subcommand, r=alexcrichton
bors [Mon, 3 May 2021 14:41:36 +0000 (14:41 +0000)]
Auto merge of #9438 - ehuss:report-subcommand, r=alexcrichton

Add `report` subcommand.

This renames the `cargo describe-future-incompatibilities` subcommand to `cargo report future-incompatibilities`. The intent here is to have a general `report` subcommand that can be used for other reports in the future. This helps avoid the proliferation of top-level subcommands, and to help keep the CLI a little more organized.

3 years agoAuto merge of #9186 - weihanglo:issue-9054, r=alexcrichton
bors [Sat, 1 May 2021 15:35:48 +0000 (15:35 +0000)]
Auto merge of #9186 - weihanglo:issue-9054, r=alexcrichton

Respect Cargo.toml `[package.exclude]` even not in a git repo.

May resolves #9054

This bug (or feature?) has been lingering for a while. #7680 fixed the `cargo package` part but `cargo vendor` is still affected by the heuristic rule of ignoring dotfiles. ~~I propose to drop the rule and include dotfiles by default even if the package is not under git-controlled~~. See below.

## Updated: Changes Summary

`cargo vendor` vendors dependencies without git-controlled but `cargo package` often runs under a VCS like git. [These lines](https://github.com/rust-lang/cargo/blob/1ca930b/src/cargo/sources/path.rs#L161-L168) are where they diverges: `fn list_files_walk_except_dot_files_and_dirs` builds [its own ignore instance], which cannot merge with other filter rules from `[package.exclude]`. This causes some patterns to not work as expected, such as re-including file after ignoring dotfiles `[.*, !negated_file]`.

To make re-include (negate) rule works, this patch adds the excluding dotfiles rule directly into the `package.exclude` ignore instance if **_no include option nor git repo exists_**. Other old behaviors should not change in this patch.

[its own ignore instance]: https://github.com/rust-lang/cargo/blob/1ca930b6/src/cargo/sources/path.rs#L364-L366

3 years agoAuto merge of #9439 - ehuss:contrib-crates, r=Eh2406
bors [Sat, 1 May 2021 02:17:06 +0000 (02:17 +0000)]
Auto merge of #9439 - ehuss:contrib-crates, r=Eh2406

Document the other crates in the codebase in the contrib guide.

3 years agoAuto merge of #9440 - ehuss:fix-metrics-test, r=Eh2406
bors [Fri, 30 Apr 2021 21:50:27 +0000 (21:50 +0000)]
Auto merge of #9440 - ehuss:fix-metrics-test, r=Eh2406

Fix problem with metrics test.

The `counter_zero_slot` test was checking for an assertion that only fires in a debug build. However, upstream `rust-lang/rust` runs tests in `--release` mode. This unblocks the upstream update.

3 years agoFix problem with metrics test.
Eric Huss [Fri, 30 Apr 2021 21:03:16 +0000 (14:03 -0700)]
Fix problem with metrics test.

3 years agoDocument the other crates in the codebase in the contrib guide.
Eric Huss [Fri, 30 Apr 2021 20:24:35 +0000 (13:24 -0700)]
Document the other crates in the codebase in the contrib guide.

3 years agoAdd `report` subcommand.
Eric Huss [Fri, 30 Apr 2021 20:01:21 +0000 (13:01 -0700)]
Add `report` subcommand.

3 years agoAuto merge of #9395 - weihanglo:issue-8483, r=alexcrichton
bors [Fri, 30 Apr 2021 14:12:40 +0000 (14:12 +0000)]
Auto merge of #9395 - weihanglo:issue-8483, r=alexcrichton

Show transfer rate when fetching/updating registry index

Possibly fixes #8483.

To avoid blinking too frequently, update rate is throttled by one second.

I am not sure how to write tests for it 😂

<img width="896" alt="image" src="https://user-images.githubusercontent.com/14314532/115879831-ac62fb00-a47c-11eb-9b12-735ce8192ebe.png">

# Updated (2020-04-28)

Current looking

```
    Updating crates.io index
       Fetch [==>                      ]  14.50%, 258.45KiB/s

    Updating crates.io index
       Fetch [======>                  ]  40.50%, (1234/282342) resolving deltas
```

3 years agoAuto merge of #9434 - ehuss:collision-doc-j1, r=Eh2406
bors [Thu, 29 Apr 2021 18:21:49 +0000 (18:21 +0000)]
Auto merge of #9434 - ehuss:collision-doc-j1, r=Eh2406

Fix collision doc tests randomly failing.

This fixes some tests that were randomly failing on CI. The cause is that #9419 added a remove_dir_all on the `doc` directory. However, if two jobs are trying to write to that directory at the same time, this can cause errors.  The failure rate is low (a little over 1%), and I was unable to reproduce locally (only on GitHub's CI and only on the Windows job).

The solution is to run the jobs with -j1 so they run serially.

 I only saw errors for `collision_doc_sources`, but to be on the safe side I added j1 to similar tests.

3 years agoFix collision doc tests randomly failing.
Eric Huss [Thu, 29 Apr 2021 17:42:42 +0000 (10:42 -0700)]
Fix collision doc tests randomly failing.

3 years agoAuto merge of #9429 - ehuss:unstable-updates2, r=alexcrichton
bors [Thu, 29 Apr 2021 15:22:26 +0000 (15:22 +0000)]
Auto merge of #9429 - ehuss:unstable-updates2, r=alexcrichton

Add missing tracking issues and unstable docs.

Adds some missing tracking issues, and adds documentation for `-Z doctest-in-workspace`.

3 years agoAuto merge of #9421 - lf-:meowwwwww, r=alexcrichton
bors [Thu, 29 Apr 2021 14:54:23 +0000 (14:54 +0000)]
Auto merge of #9421 - lf-:meowwwwww, r=alexcrichton

Fix dep-info files emitting paths relative to deps' roots

Sample `shoo.d` file prior to this change is below, note the `build.rs`
at the end, which was not from my package.

From booping the debugger, I found this was coming from
`compiler_builtins`.  This is not really their bug though: if a build.rs
asks for rerun-if-changed on some crate relative path, this will happen
in general. So I've fixed it in Cargo and added a test to prevent it
regressing.

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s build.rs
```

This change fixes it so it's like:

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/build.rs /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.14/build.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s
```

3 years agoAuto merge of #9428 - rust-lang:dependabot/add-v2-config-file, r=alexcrichton
bors [Thu, 29 Apr 2021 14:26:04 +0000 (14:26 +0000)]
Auto merge of #9428 - rust-lang:dependabot/add-v2-config-file, r=alexcrichton

Upgrade to GitHub-native Dependabot

_Dependabot Preview will be shut down on August 3rd, 2021. In order to keep getting Dependabot updates, please merge this PR and migrate to GitHub-native Dependabot before then._

Dependabot has been fully integrated into GitHub, so you no longer have to install and manage a separate app. This pull request migrates your configuration from Dependabot.com to a config file, using the [new syntax][new_syntax]. When merged, we'll swap out `dependabot-preview` (me) for a new `dependabot` app, and you'll be all set!

With this change, you'll now use the [Dependabot page in GitHub][dependabot_page], rather than the [Dependabot dashboard][dashboard], to monitor your version updates, and you'll configure Dependabot through the new config file rather than a UI.

If you've got any questions or feedback for us, please let us know by creating an issue in the [dependabot/dependabot-core][issues] repository.

[Learn more about migrating to GitHub-native Dependabot][learn]

Please note that regular ``@dependabot`` commands do not work on this pull request.

[dashboard]: https://app.dependabot.com/
[dependabot_page]: https://github.com/rust-lang/cargo/network/updates
[issues]: https://github.com/dependabot/dependabot-core/issues/new?assignees=%40dependabot%2Fpreview-migration-reviewers&labels=E%3A+preview-migration&template=migration-issue.md
[learn]: http://docs.github.com/code-security/supply-chain-security/upgrading-from-dependabotcom-to-github-native-dependabot
[new_syntax]: https://help.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
[org_secrets_url]: https://github.com/organizations/rust-lang/settings/secrets/dependabot
[repo_secrets_url]: https://github.com/rust-lang/cargo/settings/secrets/dependabot

3 years agoAdd missing tracking issues and unstable docs.
Eric Huss [Wed, 28 Apr 2021 21:39:55 +0000 (14:39 -0700)]
Add missing tracking issues and unstable docs.

3 years agoUpgrade to GitHub-native Dependabot
dependabot-preview[bot] [Wed, 28 Apr 2021 21:38:01 +0000 (21:38 +0000)]
Upgrade to GitHub-native Dependabot

3 years agocomment about caveat of current transfer rate refresh
Weihang Lo [Wed, 28 Apr 2021 17:00:14 +0000 (01:00 +0800)]
comment about caveat of current transfer rate refresh

3 years agofix: bytes per second should not prefix with `i`
Weihang Lo [Wed, 28 Apr 2021 16:58:58 +0000 (00:58 +0800)]
fix: bytes per second should not prefix with `i`

3 years agoAuto merge of #9425 - JohnTitor:tweak-cargo-fix-test, r=alexcrichton
bors [Wed, 28 Apr 2021 14:16:49 +0000 (14:16 +0000)]
Auto merge of #9425 - JohnTitor:tweak-cargo-fix-test, r=alexcrichton

Only deny the `unused_mut` lint

This is needed for rust-lang/rust#83004 to pass CI.

3 years agoOnly deny the `unused_mut` lint
Yuki Okushi [Wed, 28 Apr 2021 08:59:57 +0000 (17:59 +0900)]
Only deny the `unused_mut` lint

3 years agoFix test on Windows: reprise
Jade [Wed, 28 Apr 2021 05:30:35 +0000 (22:30 -0700)]
Fix test on Windows: reprise

3 years agoFix the test on Windows
Jade [Wed, 28 Apr 2021 04:21:56 +0000 (21:21 -0700)]
Fix the test on Windows

3 years agorefactor: pass Instant to MetricsCounter
Weihang Lo [Tue, 27 Apr 2021 14:46:46 +0000 (22:46 +0800)]
refactor: pass Instant to MetricsCounter

3 years agoAuto merge of #9419 - ehuss:doc-meta-rebuild, r=alexcrichton
bors [Tue, 27 Apr 2021 14:35:53 +0000 (14:35 +0000)]
Auto merge of #9419 - ehuss:doc-meta-rebuild, r=alexcrichton

Fix rebuild issues with rustdoc.

This fixes two issues related to rebuilds with rustdoc:

* Switching features when running `cargo doc` would result in Cargo not rebuilding the documentation. This is because it was keeping the fingerprints in separate directories based on the features used. However, the rustdoc output isn't keyed off the metadata hash, so although the old fingerprint seemed "up to date", in reality the documentation was rewritten and needs to be rebuilt. The solution is to use a simplified hash for the fingerprint directory name.
* Removing items does not remove the files from the doc directory. This changes it to clear the package's doc directory before running rustdoc, to ensure any stale files are removed.

I'm a little concerned about potential performance impact of running `remove_dir_all`, but I think it shouldn't be too bad?

Fixes #7370

3 years agoAuto merge of #9418 - ehuss:always-meta, r=alexcrichton
bors [Tue, 27 Apr 2021 14:08:31 +0000 (14:08 +0000)]
Auto merge of #9418 - ehuss:always-meta, r=alexcrichton

Always use full metadata hash for -C metadata.

This changes it so that cargo always uses the full metadata hash for `-C metadata`. This ensures that even if a unit isn't using `-C extra-filename` that the symbol hashing uses all the fields used in the other cases.

This fixes an issue on macOS where a combination of split-debuginfo and incremental caused the same `.o` filenames to be used, which caused corruption in the incremental cache (see issue for details).

Fixes #9353.

3 years agoFix dep-info files emitting paths relative to deps' roots
Jade [Tue, 27 Apr 2021 11:25:46 +0000 (04:25 -0700)]
Fix dep-info files emitting paths relative to deps' roots

Sample `shoo.d` file prior to this change is below, note the `build.rs`
at the end, which was not from my package.

From booping the debugger, I found this was coming from
`compiler_builtins`.  This is not really their bug though: if a build.rs
asks for rerun-if-changed on some crate relative path, this will happen
in general. So I've fixed it in Cargo and added a test to prevent it
regressing.

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s build.rs
```

This change fixes it so it's like:

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/build.rs /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.14/build.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s
```

3 years agorefactor: use metrics counter as an abstaction
Weihang Lo [Tue, 27 Apr 2021 05:48:36 +0000 (13:48 +0800)]
refactor: use metrics counter as an abstaction

3 years agofeat: add metrics counter utility
Weihang Lo [Tue, 27 Apr 2021 05:47:36 +0000 (13:47 +0800)]
feat: add metrics counter utility

3 years agoClear rustdoc output just before running rustdoc.
Eric Huss [Tue, 27 Apr 2021 04:04:01 +0000 (21:04 -0700)]
Clear rustdoc output just before running rustdoc.

3 years agoUse consolidated fingerprint directory for rustdoc.
Eric Huss [Tue, 27 Apr 2021 04:02:29 +0000 (21:02 -0700)]
Use consolidated fingerprint directory for rustdoc.

3 years agoAlways use full metadata hash for -C metadata.
Eric Huss [Tue, 27 Apr 2021 03:18:53 +0000 (20:18 -0700)]
Always use full metadata hash for -C metadata.

3 years agoAuto merge of #9030 - Ekleog:target-setting, r=alexcrichton
bors [Mon, 26 Apr 2021 15:00:47 +0000 (15:00 +0000)]
Auto merge of #9030 - Ekleog:target-setting, r=alexcrichton

Expose build.target .cargo/config setting as packages.target in Cargo.toml

Hey!

I'm trying to do my first cargo contribution by implementing per-crate target settings as per [the irlo thread](https://internals.rust-lang.org/t/proposal-move-some-cargo-config-settings-to-cargo-toml/13336) ; and I think I have a draft that looks good-ish (the root units returned by `generate_targets` have the right kinds set).

Closes #7004

**_Edit: the below problem description is now solved in the latest version of this PR, please ignore_**

But for some reason running on a test project now blocks on `Blocking waiting for file lock on build directory` and I have literally no idea how my changes could trigger this… would anyone have an idea of how the changes could lead to infinitely blocking there? (I already tried cargo clean just in case and it didn't appear to help)

FWIW, the output that looks hopeful to me is, on my testbed workspace:
```
Root units [out of generate_targets] are [...]:
 - package ‘smtp-client’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-server’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-rpc’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config-example’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config-example’ with kind ‘Target(CompileTarget { name: "wasm32-unknown-unknown" })’
 - package ‘smtp-queue’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-server-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config’ with kind ‘Target(CompileTarget { name: "wasm32-unknown-unknown" })’
 - package ‘yuubind’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-queue-fs’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
```
(where both `yuubind-config` and `yuubind-config-example` are being configured to be `wasm32-unknown-unknown` and the other ones stay as host).

Interestingly enough, if I remove the `target` setting from `yuubind-config` (and leave it on `yuubind-config-example`) then it does no longer block on waiting for file lock on build directory, even though it does not actually compile with `wasm32-unknown-unknown`. And it does appear to correctly build yuubind-config-example as wasm32.

My investigation shows that it appears to happen iff there is a package with `package.target` being set that has dependencies.

This most likely is a bug in my code (eg. I build only the root units and not the whole unit graph maybe?), and am going to keep investigating it as such, but maybe someone would already know how dependency resolution could interact with build lock acquisition and give me hints?

Anyway, thank you all for all you do cargo!

3 years agoAuto merge of #9404 - ehuss:rustdoc-fingerprint-remove-dir, r=alexcrichton
bors [Mon, 26 Apr 2021 14:13:37 +0000 (14:13 +0000)]
Auto merge of #9404 - ehuss:rustdoc-fingerprint-remove-dir, r=alexcrichton

Some changes to rustdoc fingerprint checking.

#8640 introduced a check which deletes the `doc` directory if cargo detects it has stale contents from a different toolchain version. Rustdoc has some shared files (js and css for example) that can get corrupted between versions. Unfortunately that caused some problems with rustbuild which does a few unusual things. Rustbuild will:

* Create the `doc` directory before running `cargo doc` and places a `.stamp` file inside it.
* Creates symlinks of the `doc` directory so that they can be shared across different target directories (in particular, between rustc and rustdoc).

In order to address these issues, this PR does several things:

* Adds `-Z skip-rustdoc-fingerprint` to disable the `doc` clearing behavior.
* Don't delete the `doc` directory if the rustdoc fingerprint is missing. This is intended to help with the scenario where the user creates a `doc` directory ahead of time with pre-existing contents before the first build. The downside is that cargo will not be able to protect against switching from pre-1.53 to post-1.53.
* Don't delete the `doc` directory itself (just its contents). This should help if the user created the `doc` directory as a symlink to somewhere else.
* Don't delete hidden files in the `doc` directory. This isn't something that rustdoc creates.

Only the `-Z` change is needed for rustbuild. The others I figured I'd include just to be on the safe side in case there are other users doing unusual things (and I had already written them thinking they would work for rustbuild). Hopefully the rustbuild `.stamp` mechanism will be enough protection there.

Fixes #9336

3 years agoAuto merge of #9405 - Hawk777:cargo-pkg-for-build-scripts, r=ehuss
bors [Sat, 24 Apr 2021 23:21:19 +0000 (23:21 +0000)]
Auto merge of #9405 - Hawk777:cargo-pkg-for-build-scripts, r=ehuss

Document that CARGO_PKG_ are availble to build.rs

Fixes GH-9403.

3 years agofix build
Léo Gaspard [Sat, 24 Apr 2021 17:40:48 +0000 (19:40 +0200)]
fix build

3 years agoDocument that CARGO_PKG_ are availble to build.rs
Christopher Head [Sat, 24 Apr 2021 17:35:39 +0000 (10:35 -0700)]
Document that CARGO_PKG_ are availble to build.rs

3 years agohandle review comments
Léo Gaspard [Sat, 24 Apr 2021 17:09:13 +0000 (19:09 +0200)]
handle review comments

3 years agoImprove error message on missing feature gate
Léo Gaspard [Sat, 10 Apr 2021 05:00:27 +0000 (07:00 +0200)]
Improve error message on missing feature gate

3 years agoExpose build.target .cargo/config setting as packages.target in Cargo.toml
Léo Gaspard [Thu, 31 Dec 2020 01:33:39 +0000 (02:33 +0100)]
Expose build.target .cargo/config setting as packages.target in Cargo.toml

3 years agoAdd tests for new rustdoc fingerprint behavior.
Eric Huss [Sat, 24 Apr 2021 16:08:21 +0000 (09:08 -0700)]
Add tests for new rustdoc fingerprint behavior.

3 years agoAdd -Zskip-rustdoc-fingerprint
Eric Huss [Sat, 24 Apr 2021 15:22:44 +0000 (08:22 -0700)]
Add -Zskip-rustdoc-fingerprint

This is a hidden flag intended to only be used by rustbuild which will
skip the rustdoc fingerprint check. rustbuild does some funky things
with sharing the doc directory across multiple target directories via
symlinks, and that causes problems where after building in one target
directory, then switching to the second one, it will clear the contents.

3 years agorustdoc fingerprint: don't delete the top directory
Eric Huss [Sat, 24 Apr 2021 15:07:57 +0000 (08:07 -0700)]
rustdoc fingerprint: don't delete the top directory

In some cases, the directory may actually be a symlink created by the
user, and we don't want to delete it. Also, skip any hidden files added
by the user as well.

3 years agoDon't delete doc directories if the rustdoc fingerprint is missing.
Eric Huss [Fri, 16 Apr 2021 00:52:25 +0000 (17:52 -0700)]
Don't delete doc directories if the rustdoc fingerprint is missing.

This also rearranges the code a little bit to try to avoid some
duplication and to try to make it a little more compact.

3 years agoMake doc_fingerprint_respects_target_paths work on all targets.
Eric Huss [Fri, 16 Apr 2021 00:49:38 +0000 (17:49 -0700)]
Make doc_fingerprint_respects_target_paths work on all targets.

3 years agoAuto merge of #9397 - alexcrichton:fix-hash, r=ehuss
bors [Fri, 23 Apr 2021 20:54:54 +0000 (20:54 +0000)]
Auto merge of #9397 - alexcrichton:fix-hash, r=ehuss

Restore crates.io's `SourceId` hash value to before

This commit restores the hash value of the crates.io `SourceId` to what
it was before #9384. In #9384 the enum variants of `SourceKind` were
reordered which accidentally changed the hash value of the `SourceId`
for crates.io. A change here means that users with a new version of
Cargo will have to redownload the index and all crates, which is
something that we strive to avoid forcing.

In changing this, though, it required a manual implementation of `Ord`
to still contain the actual fix from #9384 which is to sort `SourceKind`
differently from how it's defined. I was curious as to why this was
necessary since it wasn't ever necessary in the past and this led to an
odd spelunking which turned up some interesting information. Turns out
Rust 1.47 and after had a breaking change where Cargo would sort
dependencies differently. This means that #9334 *could* have been opened
up much earlier, but it never was. We ironically only saw an issue when
we fixed this regression (although we didn't realize we were fixing a
regression). This means that we are now permanently codifying the
regression in Cargo.

3 years agoClarify some versions
Alex Crichton [Fri, 23 Apr 2021 19:27:19 +0000 (12:27 -0700)]
Clarify some versions

3 years agofix: message of progress when resolving deltas
Weihang Lo [Fri, 23 Apr 2021 19:18:30 +0000 (03:18 +0800)]
fix: message of progress when resolving deltas

3 years agoRestore crates.io's `SourceId` hash value to before
Alex Crichton [Fri, 23 Apr 2021 18:59:18 +0000 (11:59 -0700)]
Restore crates.io's `SourceId` hash value to before

This commit restores the hash value of the crates.io `SourceId` to what
it was before #9384. In #9384 the enum variants of `SourceKind` were
reordered which accidentally changed the hash value of the `SourceId`
for crates.io. A change here means that users with a new version of
Cargo will have to redownload the index and all crates, which is
something that we strive to avoid forcing.

In changing this, though, it required a manual implementation of `Ord`
to still contain the actual fix from #9384 which is to sort `SourceKind`
differently from how it's defined. I was curious as to why this was
necessary since it wasn't ever necessary in the past and this led to an
odd spelunking which turned up some interesting information. Turns out
Rust 1.47 and after had a breaking change where Cargo would sort
dependencies differently. This means that #9334 *could* have been opened
up much earlier, but it never was. We ironically only saw an issue when
we fixed this regression (although we didn't realize we were fixing a
regression). This means that we are now permanently codifying the
regression in Cargo.

3 years agoAuto merge of #9392 - alexcrichton:fix-patch-git-head-issue, r=ehuss
bors [Fri, 23 Apr 2021 18:45:03 +0000 (18:45 +0000)]
Auto merge of #9392 - alexcrichton:fix-patch-git-head-issue, r=ehuss

Fix loading `branch=master` patches in the v3 lock transition

This commit fixes an issue pointed out during #9352 where in the v2->v3
lock file transition (currently happening on nightly) Cargo will not
correctly use the previous lock file entry for `[patch]` directives that
point to git dependencies using `branch = 'master'` explicitly. The
reason for this is that Cargo previously, with the v2 format, considered
`branch=master` and `DefaultBranch` to be equivalent dependencies. Now
that Cargo treats those as distinct resolve nodes we need to load lock
files that use `DefaultBranch` and transparently use those for
`branch=master` dependencies.

These lock file nodes do not naturally unify so we have to go out of our
way to get the two to line up in modern Cargo. This was previously done
for the lock file at large, but the previous logic didn't take `[patch]`
into account. Unfortunately almost everything to do with `[patch]` and
lock files is pretty complicated, and this is no exception. The fix here
is wordy, verbose, and quite subtle in how it works. I'm pretty sure it
does work though and I think that this should be good enough to at least
transition most users off the v2 lock file format. Once this has baked
in Cargo for some time (on the scale of a year) I would hope that we
could just remove this logic since it's only really here for a
transitionary period.

Closes #9352

3 years agofix: remove total bytes received from progress message
Weihang Lo [Fri, 23 Apr 2021 16:56:34 +0000 (00:56 +0800)]
fix: remove total bytes received from progress message

3 years agofix: remove unnecessary progress tick rate limiting
Weihang Lo [Fri, 23 Apr 2021 16:42:45 +0000 (00:42 +0800)]
fix: remove unnecessary progress tick rate limiting

3 years agoAuto merge of #9396 - ehuss:changelog-1.52-beta, r=alexcrichton
bors [Fri, 23 Apr 2021 16:15:36 +0000 (16:15 +0000)]
Auto merge of #9396 - ehuss:changelog-1.52-beta, r=alexcrichton

Update changelog for 1.52 beta changes.

A few things were reverted on the beta branch.

3 years agoUpdate changelog for 1.52 beta changes.
Eric Huss [Fri, 23 Apr 2021 16:10:32 +0000 (09:10 -0700)]
Update changelog for 1.52 beta changes.

3 years agoAuto merge of #9393 - ehuss:build-std-updating, r=alexcrichton
bors [Fri, 23 Apr 2021 14:23:21 +0000 (14:23 +0000)]
Auto merge of #9393 - ehuss:build-std-updating, r=alexcrichton

Fix build-std updating the index on every build.

https://github.com/rust-lang/rust/pull/83776 has caused a problem where build-std will update the index on every build. That PR added `std_detect` from the `stdarch` submodule as a path dependency of `std`. However, since `stdarch` has a workspace of its own, an exclusion had to be added to `Cargo.toml` so that it does not treat `std_detect` as a workspace member (because nested workspaces are not supported).

The problem is that the std `Cargo.lock` file is built thinking that `std_detect` is *not* a workspace member. This means that its dev-dependencies are not included. However, when cargo resolves the std workspace, it doesn't know that `std_detect` should be excluded, so it considers it a workspace member (because it is a path dependency). This means that it expects the dev-dependencies to be in Cargo.lock. Because they are missing, it ends up poisoning the registry and triggering an update:

> poisoning registry `https://github.com/rust-lang/crates.io-index` because std_detect v0.1.5 (/Users/eric/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/stdarch/crates/std_detect) looks like it changed auxv

The solution here is to skip dev-dependencies if they are not actively being resolved, even if the package is a workspace member.

This has happened before (#8962), so I have updated the test to check for it.

There are some alternative solutions I considered:

* Add support for nested workspaces. 😄
* Use a symlink to `std_detect` in the `rust-lang/rust` repository so that it appears to cargo as-if it is "outside" of the stdarch workspace, and thus can be treated like a normal workspace member (and remove the "exclude"). That seems a little hacky.

Fixes #9390

3 years agofeat: show transfer rate and total bytes received
Weihang Lo [Fri, 23 Apr 2021 13:32:27 +0000 (21:32 +0800)]
feat: show transfer rate and total bytes received