Commit graph

10827 commits

Author SHA1 Message Date
Eric Huss
fac524376d Some cleanup. 2021-05-04 08:50:41 -07:00
bors
1228f49d74 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.
2021-05-03 14:41:36 +00:00
bors
db741ac733 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
2021-05-01 15:35:48 +00:00
bors
468314fc82 Auto merge of #9439 - ehuss:contrib-crates, r=Eh2406
Document the other crates in the codebase in the contrib guide.
2021-05-01 02:17:06 +00:00
bors
f3e13226d6 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.
2021-04-30 21:50:27 +00:00
Eric Huss
58ab9c116f Fix problem with metrics test. 2021-04-30 14:03:16 -07:00
Eric Huss
b3d922369a Document the other crates in the codebase in the contrib guide. 2021-04-30 13:24:35 -07:00
Eric Huss
ff49b829e6 Add report subcommand. 2021-04-30 13:01:21 -07:00
bors
6701e33f69 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
```
2021-04-30 14:12:40 +00:00
bors
96be6747cd 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.
2021-04-29 18:21:49 +00:00
Eric Huss
5003d53c79 Fix collision doc tests randomly failing. 2021-04-29 10:42:42 -07:00
bors
c564ae8a94 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`.
2021-04-29 15:22:26 +00:00
bors
5b76b84f7a 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
```
2021-04-29 14:54:23 +00:00
bors
3b05f5fb6a 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
2021-04-29 14:26:04 +00:00
Eric Huss
06fa940b47 Add missing tracking issues and unstable docs. 2021-04-28 14:39:55 -07:00
dependabot-preview[bot]
55f7d93e88
Upgrade to GitHub-native Dependabot 2021-04-28 21:38:01 +00:00
Weihang Lo
e4d4347223 comment about caveat of current transfer rate refresh 2021-04-29 01:00:14 +08:00
Weihang Lo
9df531b223 fix: bytes per second should not prefix with i 2021-04-29 00:58:58 +08:00
bors
e9e09077a1 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.
2021-04-28 14:16:49 +00:00
Yuki Okushi
e5ab39145f Only deny the unused_mut lint 2021-04-28 17:59:57 +09:00
Jade
b998364e6b Fix test on Windows: reprise 2021-04-27 22:30:35 -07:00
Jade
5bba21afe4 Fix the test on Windows 2021-04-27 21:21:56 -07:00
Weihang Lo
a89b1e8a9f
refactor: pass Instant to MetricsCounter 2021-04-27 22:46:46 +08:00
bors
4369396ce7 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
2021-04-27 14:35:53 +00:00
bors
52a0ca5cc3 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.
2021-04-27 14:08:31 +00:00
Jade
fc5840d175 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
```
2021-04-27 05:08:33 -07:00
Weihang Lo
de84f352e4
refactor: use metrics counter as an abstaction 2021-04-27 14:23:44 +08:00
Weihang Lo
a813ba0070
feat: add metrics counter utility 2021-04-27 14:23:42 +08:00
Eric Huss
44c549e650 Clear rustdoc output just before running rustdoc. 2021-04-26 21:04:01 -07:00
Eric Huss
77855f3636 Use consolidated fingerprint directory for rustdoc. 2021-04-26 21:02:29 -07:00
Eric Huss
256c43c2f1 Always use full metadata hash for -C metadata. 2021-04-26 20:18:53 -07:00
bors
d1c0a9d9ca 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!
2021-04-26 15:00:47 +00:00
bors
a3ff382a54 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
2021-04-26 14:13:37 +00:00
bors
d1baf0d81d Auto merge of #9405 - Hawk777:cargo-pkg-for-build-scripts, r=ehuss
Document that CARGO_PKG_ are availble to build.rs

Fixes GH-9403.
2021-04-24 23:21:19 +00:00
Léo Gaspard
fcd761729e fix build 2021-04-24 19:40:48 +02:00
Christopher Head
1624d465ef
Document that CARGO_PKG_ are availble to build.rs 2021-04-24 10:35:39 -07:00
Léo Gaspard
731d881a60 handle review comments 2021-04-24 19:12:52 +02:00
Léo Gaspard
2bef76aed9 Improve error message on missing feature gate 2021-04-24 19:12:52 +02:00
Léo Gaspard
5e11afc1ab Expose build.target .cargo/config setting as packages.target in Cargo.toml 2021-04-24 19:12:52 +02:00
Eric Huss
c373867304 Add tests for new rustdoc fingerprint behavior. 2021-04-24 09:08:21 -07:00
Eric Huss
6f75160a88 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.
2021-04-24 08:22:44 -07:00
Eric Huss
f130ef98c2 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.
2021-04-24 08:07:57 -07:00
Eric Huss
ca611aefb2 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.
2021-04-23 14:31:14 -07:00
Eric Huss
d17c85132b Make doc_fingerprint_respects_target_paths work on all targets. 2021-04-23 14:31:14 -07:00
bors
0ed318d182 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.
2021-04-23 20:54:54 +00:00
Alex Crichton
d99c35c2e3 Clarify some versions 2021-04-23 12:27:19 -07:00
Weihang Lo
f2172db6da
fix: message of progress when resolving deltas 2021-04-24 03:18:30 +08:00
Alex Crichton
4567826e9a 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.
2021-04-23 12:04:26 -07:00
bors
c321437b53 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
2021-04-23 18:45:03 +00:00
Weihang Lo
507d7e42b0
fix: remove total bytes received from progress message 2021-04-24 02:13:02 +08:00