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.
bors [Wed, 18 Aug 2021 14:09:06 +0000 (14:09 +0000)]
Auto merge of #9803 - ehuss:fix-edition-resolve-differences-dev-deps, r=alexcrichton
Show feature resolver differences for dev-dependencies.
During the crater run for 2021, there was a package that failed to update in a confusing way. The issue is that a feature was removed in the new resolver, but only for a dev-dependency. The report displayed with `cargo fix --edition` did not say anything about that, so it took me a bit to figure it out. This changes it so that the report also includes changes to features of dev-dependencies. I honestly don't remember my thought process behind the original code.
For example, the offending package now says:
```
When building the following dependencies, the given features will no longer be used:
And the error that happens after updating to 2021 is:
```
error[E0277]: the trait bound `UniCase<&str>: phf_shared::PhfHash` is not satisfied
--> /Users/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/mime_guess-1.8.7/build.rs:37:21
|
37 | forward_map.entry(UniCase(key), &format!("{:?}", val));
| ^^^^^ the trait `phf_shared::PhfHash` is not implemented for `UniCase<&str>`
```
Hopefully developers will be able to see the note about the feature `unicase` being removed from `phf_shared`, and the error message about `UniCase` not implementing `PhfHash`, and connect the two together. Previously, the upgrade report didn't mention anything about `phf_shared`, and thus no clues on what went wrong.
bors [Tue, 17 Aug 2021 18:47:05 +0000 (18:47 +0000)]
Auto merge of #9799 - ehuss:fix-abnormal-error, r=alexcrichton
Show information about abnormal `fix` errors.
During a recent crater run, we ran into a few circumstances where `cargo fix` failed unexpectedly, and we can't reproduce the errors locally. The sequence was:
1. Cargo ran `rustc` and collected the diagnostics to apply, and modified the files.
2. Cargo ran `rustc` again to verify the fixes. This step failed, but only emitted warnings.
3. Cargo ran `rustc` again to show the original diagnostics, and this exited normally with warnings.
We don't know why the second step failed. This change makes it so that cargo will collect any non-diagnostic messages (like ICEs), and will also display the exit code if it is abnormal.
bors [Mon, 16 Aug 2021 14:09:42 +0000 (14:09 +0000)]
Auto merge of #9789 - ehuss:fix-value-after-table-profile, r=alexcrichton
Fix value-after-table error with profiles.
If the `strip`, `dir-name`, or `inherits` fields were included along with a profile override, then `cargo publish` would fail with a `ValueAfterTable` error because the fields were listed in the wrong order in the struct definition.
bors [Wed, 11 Aug 2021 21:11:45 +0000 (21:11 +0000)]
Auto merge of #9627 - whereistejas:many-bin-names, r=ehuss
Ability to specify the output name for a bin target different from the crate name
Hi,
I have opened this to close the following issue #1706 .
I have decided to start by writing a test to outline what behavior is expected from `Cargo`.
As of now, this test fails (for obvious reasons). I will now start writing the code needed to pass this test.
This is my first time contributing to cargo. Please, feel free to let me know if there are any protocols/processes that need to be followed. I'm a newbie at this.
bors [Fri, 6 Aug 2021 14:39:45 +0000 (14:39 +0000)]
Auto merge of #9767 - nipunn1313:refactor, r=alexcrichton
Refactor fake_file() away from cargo_command tests
There are already similar preexisting test helpers which
also work on windows. Port over the executable-creation
helper into the file() helper and things appear to pass.
Was inspired to do this when trying to add tests to solve a separate issue.
Refactor fake_file() away from cargo_command tests
There are already similar preexisting test helpers which
also work on windows. Port over the executable-creation
helper into the file() helper and things appear to pass.
bors [Thu, 5 Aug 2021 01:23:53 +0000 (01:23 +0000)]
Auto merge of #9762 - erickt:bump, r=ehuss
Update cargo-platform to 0.1.2
This preps cargo-platform for a release. The only substantial change is that this should include the license files into the archive that is uploaded to crates.io.
Erick Tryzelaar [Wed, 4 Aug 2021 23:11:52 +0000 (16:11 -0700)]
Update cargo-platform to 0.1.2
This preps cargo-platform for a release. The only substantial change is that
this should include the license files into the archive that is uploaded to
crates.io.
bors [Mon, 2 Aug 2021 20:28:08 +0000 (20:28 +0000)]
Auto merge of #9732 - djc:rust-version-docs, r=ehuss
Stabilize the rust-version field
I've tried to make the documentation here fairly comprehensive. I've also updated the first version for the 2021 edition, which should now be stable pending substantial unforeseen changes.