Auto merge of #9927 - weiznich:diesel_2021_edition, r=ehuss
Change diesel compatibility messages
Diesel 1.4.8 fixes the critical behaviour. This commit changes the
corresponding messages for `cargo fix` and normal builds to prompt the
user to just update the diesel version to fix the corresponding
compilation errors.
As discussed in https://github.com/rust-lang/rust/issues/88903#issuecomment-923061946
This stabilizes the `patch-in-config` feature ([unstable entry](https://doc.rust-lang.org/cargo/reference/unstable.html#patch-in-config)) following the discussion in https://github.com/rust-lang/cargo/issues/9269#issuecomment-904913263.
As requested, this PR _also_ changes the precedence behavior such that a `[patch]` for the same dependency in both `.cargo/config.toml` and `Cargo.toml` prefers the patch from the configuration file over the one from the manifest, which matches the behavior of other overlapping configuration options. The corresponding test has also been updated to reflect this change in behavior.
Auto merge of #9862 - dtolnay-contrib:repos, r=ehuss
Swap out some outdated repo urls in documentation
I noticed that `rand` and `rustfmt` are no longer located in rust-lang-nursery.
Rather than updating `rand` to github.com/rust-random/rand, I've swapped it out for `regex` in this PR. Some considerations:
- Preference for github.com/rust-lang over github.com/rust-random to reduce the perception of unnecessarily endorsing a project that isn't already endorsed by being in Cargo's org.
- Ruled out `libc` because make-your-own-libcpocalypse is not a fun detour for anyone following along and experimenting with git dependencies.
- Ruled out everything with a -rs suffix (`git2-rs`, `flate2-rs`, `backtrace-rs`, `futures-rs`) out of personal distaste.
- Went for something that has comparable name recognition to rand, i.e. ruled out `hashbrown`.
We could alternatively use dummy URLs like github.com/user/example everywhere but I feel that maintaining this every several years is not a big deal and is worth it for the character of the documentation.
bors [Mon, 30 Aug 2021 14:17:26 +0000 (14:17 +0000)]
Auto merge of #9846 - ehuss:fix-only-edition-lints, r=alexcrichton
Change `cargo fix --edition` to only fix edition lints.
This changes it so that `cargo fix --edition` will only fix edition lints. The reason for this is that sometimes non-edition lints get in the way, and make suggestions that can cause failures. An example is a user that only ever runs `cargo test` or `cargo check --profile=test` locally, and doesn't realize there are problems with running without `cfg(test)` such as unused warnings.
This works by using `--cap-lints=allow` along with `--force-warn` which takes precedence over `cap-lints`.
This only works on nightly since `--force-warn` is still unstable. I will update this as part of #9800.
bors [Fri, 27 Aug 2021 19:40:28 +0000 (19:40 +0000)]
Auto merge of #9848 - nipunn1313:desc, r=alexcrichton
Show desc of well known subcommands (fmt, clippy) in cargo --list
Fixes #8680
An approach to #8680 that shows these in `cargo --list` without showing them directly in the `cargo --help`.
```
➜ cargo git:(desc) target/debug/cargo --list | grep clippy
clippy Checks a package to catch common mistakes and improve your Rust code.
```
Here's what mine looks like visually now:
![image](https://user-images.githubusercontent.com/1300387/131178775-2255ef0d-1993-47dd-bc73-9015394b967c.png)
bors [Thu, 26 Aug 2021 22:54:55 +0000 (22:54 +0000)]
Auto merge of #9843 - ehuss:fix-test-cargo-env, r=alexcrichton
Fix test not to rely on `cargo` in PATH.
This fixes a test that was trying to execute `cargo` from PATH. This test doesn't work on rust-lang/rust where the rustup installation is removed, and thus there is no `cargo` in PATH.
bors [Wed, 25 Aug 2021 17:36:11 +0000 (17:36 +0000)]
Auto merge of #9827 - weihanglo:issue-6199, r=Eh2406
Improve resolver message to include dependency requirements
Resolves #6199.
Thanks for previous efforts: #5452, #6374, #6665, which are great but somehow outdated, so I tweak them and create this PR. This will also be obsolete if we ship pubgrub-rs with cargo in the future 😃 But before that happens, IMO these changes are still helpful.
I am uncertain about how to resolve this. Besides the function`validate_links`, is this problem really a thing that may happen? If not, since `validate_links` only handles old validation logic, it may be ok to drop the commit a5f8bc94f5d38539dd127f735ea4d3a515c230fd and leave it as is.
bors [Mon, 23 Aug 2021 20:04:47 +0000 (20:04 +0000)]
Auto merge of #9834 - ehuss:fix-build-std-proc-macro-only, r=alexcrichton
Fix panic with build-std of a proc-macro.
If you try to run `cargo build -Zbuild-std` in a proc-macro project, cargo would panic in [`check_collisions`](https://github.com/rust-lang/cargo/blob/835d5576e1f0b917a42ba18a9556242204377cd1/src/cargo/core/compiler/context/mod.rs#L427). This is because it iterates over every Unit in the build graph checking the `outputs` for filenames. However, [`outputs`](https://github.com/rust-lang/cargo/blob/835d5576e1f0b917a42ba18a9556242204377cd1/src/cargo/core/compiler/context/compilation_files.rs#L109-L110) was missing the outputs for standard library units. That is because `outputs` is computed by walking the graph starting from the roots.
The bug here is that `attach_std_deps` was adding the standard library units to graph, even though they aren't reachable from the roots, thus creating orphans.
The solution is to avoid adding the standard library units if they are not needed (as is the case when building just a proc-macro).
bors [Mon, 23 Aug 2021 18:45:32 +0000 (18:45 +0000)]
Auto merge of #9831 - ehuss:fix-debug, r=Eh2406
Add some debug logging for `cargo fix`
This adds some debug logging to the `cargo fix` command to give better insight into what it is actually doing. I've needed to try to debug some things recently where this would have been useful, since cargo runs rustc many times with different arguments. I think this will be useful if other people report problems, we can ask them to run with `CARGO_LOG=cargo::ops::fix=trace` to gather more information.
bors [Fri, 20 Aug 2021 22:23:14 +0000 (22:23 +0000)]
Auto merge of #9814 - ehuss:move-tmp, r=alexcrichton
Move `tmp` test directory.
The `tmp` directory added in #9375 was placed within the profile directory (such as `target/debug/tmp` or `target/release/tmp`). This causes problems for any cargo target (binary, test, etc.) with the name `tmp` as there is a name collision. This PR attempts to address that by moving the `tmp` directory to the root of the target directory (`target/tmp`), and reserving the profile name "tmp".
bors [Fri, 20 Aug 2021 01:45:15 +0000 (01:45 +0000)]
Auto merge of #9809 - ehuss:bump-curl, r=Eh2406
Bump curl.
This updates to the latest version of curl (7.78). 7.77 which is used in rust-lang/rust had an issue where it was failing in Windows 8. I have confirmed that 7.78 works correctly.
bors [Thu, 19 Aug 2021 19:13:11 +0000 (19:13 +0000)]
Auto merge of #9793 - nipunn1313:install_parallel2, r=alexcrichton
Determine packages to install prior to installing
Old logic (pseudocode)
```
for krate in to_install {
pkg = determine_pkg(krate);
install_pkg(pkg);
}
```
New logic
```
let pkgs = to_install.into_iter(|krate| determine_pkg(krate));
pkgs.into_iter(|pkg| install_pkg(pkg));
```
This has the short term benefit of dumping most error messages out earlier in the process (eg a typo in the second package name).
Longer term, it might help with #9741 - as only the second loop would be parallelized. First loop shouldn't be parallelized because it would lead to redundant registry/git updates.