bors [Fri, 18 Jun 2021 03:38:12 +0000 (03:38 +0000)]
Auto merge of #9596 - ehuss:fix-dep-info-local, r=alexcrichton
Fix dep-info files including non-local build script paths.
I derped in #8177 and accidentally used the wrong unit when iterating over the dependencies when writing the `.d` file. The consequence here is that all the `rerun-if-changed` paths from a unit's dependencies are included in the `.d` file. This fixes it so that it does not include non-local dependencies.
bors [Fri, 18 Jun 2021 03:12:08 +0000 (03:12 +0000)]
Auto merge of #9595 - ehuss:ws-doc-collision-back-compat, r=alexcrichton
Relax doc collision error.
#9526 moved the `cargo doc` output name collision code to be shared with the other collision detection code. However, the way it detected collisions wasn't quite the same, and started generating errors for situations that were just warnings before. It was intended that the code should behave the same, so this PR relaxes the checks to be more like the original code. (It's still not 100% the same, but should be close enough.)
bors [Thu, 17 Jun 2021 16:20:56 +0000 (16:20 +0000)]
Auto merge of #9584 - henrifrancois:master, r=ehuss
Handle "jobs = 0" case in cargo config files
Cargo hangs without output if the jobs argument under build in a cargo/config file is set to 0. This PR handles this case by providing an appropriate error.
bors [Thu, 17 Jun 2021 14:50:47 +0000 (14:50 +0000)]
Auto merge of #9589 - ehuss:testsuite-diff, r=alexcrichton
Enhancements to testsuite error output.
This includes several changes to the testsuite error reporting in theory to help make it easier to see differences when the test output changes. The key change is to add a Myers diff with a little colored output to highlight the differences. Here is an example:
The rest of the changes here are various refactorings to try to clean up the diffing code. It ended up being far more changes than I was intending, but I did try to split things into commits to separate them.
Eric Huss [Wed, 16 Jun 2021 17:28:43 +0000 (10:28 -0700)]
Only normalize paths on windows.
I don't trust that all these transformations won't have unintended
consequences on other platforms. It is nice to verify there aren't any
backslash shenanigans on other platforms.
bors [Wed, 16 Jun 2021 14:51:06 +0000 (14:51 +0000)]
Auto merge of #9588 - ehuss:edition2021-force-warns, r=alexcrichton
Enable support for fix --edition for 2021.
This adds support for using `cargo fix --edition` to migrate to 2021.
This also uses the new, currently unstable, `--force-warns` flag. This was added because there were a significant number of crates that were "allow"ing lints that are required for migrating the edition. This wasn't a problem for 2018, because its lints were new, and all "allow" to start. For 2021, several older "warn" lints are becoming hard errors. "allow"ing them would cause the migration to fail.
bors [Sat, 12 Jun 2021 18:00:01 +0000 (18:00 +0000)]
Auto merge of #9577 - ehuss:json-test, r=alexcrichton
Fix package_default_run test.
The `package_default_run` test was checking the output of `cargo metadata`, which included the "targets" field. Unfortunately the order of the targets in this test depend on the filesystem order, so the test may randomly fail.
The fix here is to just check for the one field that this test was interested in.
An alternate solution would be to sort the targets. Another alternate solution would be to use `"{...}"` for the targets to ignore them. I kinda liked simplifying it to check just one field.
This includes a series of commits that are just general changes to the test infrastructure:
* Change cargo-test-support to use anyhow.
* Remove unused `ErrMsg`.
* Fix a bug with `verify_checks_output`.
* Remove the weird Debug impl for Execs.
* Added a helper function for getting the JSON output from cargo. (I can imagine a lot of possible enhancements here.)
Eric Huss [Fri, 11 Jun 2021 23:08:20 +0000 (16:08 -0700)]
Fix `package_default_run`.
The output was checking the `targets`, whose order depends on the
filesystem order. Instead of checking all the output, just
check the one field this test is for.
Eric Huss [Fri, 11 Jun 2021 20:12:30 +0000 (13:12 -0700)]
Fix verify_checks_output.
This was accidentally broken in
https://github.com/rust-lang/cargo/commit/cc5e9df64a7ed6b3657e9dd790e2e34387d33df5
causing it to not check in the error case (which is the only case that mattered).
bors [Fri, 11 Jun 2021 00:00:14 +0000 (00:00 +0000)]
Auto merge of #9571 - sunjay:fix_deny_warnings_but_not_others, r=alexcrichton
Change how the fix_deny_warnings_but_not_others test works
This changes how the `fix_deny_warnings_but_not_others` test works to avoid breakage from a new compiler suggestion that affects rustfix. It should still test the same thing, but through a slightly different mechanism to avoid breaking when new compiler suggestion are added.
Relevant PR for rust-lang/rust: https://github.com/rust-lang/rust/pull/83004
Full explanation in this comment: https://github.com/rust-lang/rust/pull/83004#issuecomment-859155118
Please let me know if you have a better suggestion for this fix. I believe [we're trying to land this ASAP because the beta is being cut tomorrow](https://github.com/rust-lang/rust/pull/83004#issuecomment-858481702), so I will try to get back to any feedback as soon as possible.
bors [Thu, 10 Jun 2021 16:12:42 +0000 (16:12 +0000)]
Auto merge of #9565 - KubaP:doc-fix, r=ehuss
Add mising documentation regarding `cargo doc`
It seems that the `--document-private-items` flag for `cargo doc` is automatically set when documenting a binary target. This change mentions that in the doc page.
The documentation did not mention this before, and it got me confused whilst I was trying to track down something going wrong.
bors [Thu, 10 Jun 2021 14:15:18 +0000 (14:15 +0000)]
Auto merge of #9566 - ehuss:relative-rustc-path, r=alexcrichton
Fix rustc/rustdoc config values to be config-relative.
The `rustc`, `rustdoc`, `rustc_wrapper`, and `rustc_workspace_wrapper` config values (in the `[build]` table) were being interpreted literally. This caused a problem if you used a relative path like `foo/rustc`. This would be interpreted as a relative path from whatever cwd cargo launches rustc from, which changes for different scenarios, making it essentially unusuable (since crates.io dependencies wouldn't be buildable).
Additionally, due to https://github.com/rust-lang/rust/issues/37868, it is a bad idea to use relative paths.
This changes it so that those paths are config-relative. Bare names (like "my-rustc-program") still use PATH as before.
This also includes a commit to centralize the rustc-wrapper program used by several tests so that it isn't built multiple times (and to allow several tests to work on windows).
bors [Thu, 10 Jun 2021 02:55:53 +0000 (02:55 +0000)]
Auto merge of #9567 - ehuss:new-rustfix, r=alexcrichton
Update rustfix.
This updates rustfix to 0.6.0. There are a few changes since 0.5.0, the following are noticeable changes:
* https://github.com/rust-lang/rustfix/pull/185 — Fix some panics in edge cases.
* https://github.com/rust-lang/rustfix/pull/195 — Revert revert multiple suggestions fix
The important one is https://github.com/rust-lang/rustfix/pull/195 which is necessary to handle some 2021 edition migration support. I have added a test to check that it works correctly.
bors [Wed, 9 Jun 2021 18:00:26 +0000 (18:00 +0000)]
Auto merge of #9549 - Bryysen:master, r=ehuss
Warn if an "all" target is specified, but we don't match anything
If a combination of --bins, --benches, --examples, --tests flags have
been specified, but we didn't match on anything after resolving the unit-list,
we emit a warning to make it clear that cargo didn't do anything and that the
code is unchecked.
This is my first PR and there are a couple things that I'm unsure about
* The integration test covers only one case (ideally it should cover every combination of the above mentioned flags the user can pass). I figured since the warning function is so simple, it'd best not to clog the testsuite with unnecessary `p.cargo().runs()` and whatnot. If I should make the test more comprehensive I can do that, it's also very easy to write unit tests so i can do that as well if needed.
* I figure we don't actually have to check the `--all-targets`, but i'm doing so for consistency. I also didn't check for the `--lib` flag at all because (I'm assuming) if the user passes `--lib` and there are no libraries, we error.
Edit: I notice (among other things) we sometimes silently skip certain units that have incompatible feature flags (see [here](https://github.com/rust-lang/cargo/blob/ed0c8c6d66e36fafbce4f78907a110838797ae39/src/cargo/ops/cargo_compile.rs#L1140)) so maybe we should be checking the `--lib` flag after all, in the event that a library was silently skipped and we no-opped :thinking:
And thanks to `@ehuss` for taking the time to answer my questions and helping me through the contribution process, much appreciated
Bryysen [Sun, 6 Jun 2021 23:36:36 +0000 (01:36 +0200)]
Warn if an "all" target is specified, but we don't match anything
If a combination of --bins, --benches, --examples, --tests flags have
been specified, but we didn't match on anything after resolving the unit-list,
we emit a warning to make it clear that cargo didn't do anything and that the
code is unchecked.
bors [Wed, 9 Jun 2021 00:28:53 +0000 (00:28 +0000)]
Auto merge of #9520 - weihanglo:tree-prune, r=ehuss
Add `--prune` option for cargo-tree
Part of #8105
Prune the given package from the display of the dependency tree. Also providing a nice suggestion if the package is not within the resolved dependency graph.
bors [Sat, 5 Jun 2021 17:21:05 +0000 (17:21 +0000)]
Auto merge of #9515 - pickfire:patch-1, r=ehuss
Add additional test for CJK progress width
Not clear if CJK test hit boundary, since CJK characters have double width,
if we show an example with an extra single width means one of them hit
character boundary to be able to test ellipsis handling.
bors [Fri, 4 Jun 2021 16:29:57 +0000 (16:29 +0000)]
Auto merge of #9544 - dtolnay-contrib:semverx, r=alexcrichton
Pull in semver 1.0.3 'x' fix
As requested in https://github.com/rust-lang/rust/pull/85983#issuecomment-854682640 -- a Cargo.toml update to ensure Cargo-the-library users always get https://github.com/dtolnay/semver/pull/247. Fixes https://github.com/rust-lang/cargo/issues/9543.
Ivan Tham [Thu, 27 May 2021 17:19:22 +0000 (01:19 +0800)]
Add additional test for CJK progress width
Not clear if CJK test hit boundary, since CJK characters have double width,
if we show an example with an extra single width means one of them hit
character boundary to be able to test ellipsis handling.
bors [Tue, 1 Jun 2021 17:26:35 +0000 (17:26 +0000)]
Auto merge of #9523 - ehuss:link-args-validate, r=alexcrichton
Add some validation to rustc-link-arg
This adds some validation, so that if a `cargo:rustc-link-arg-*` build script instruction specifies a target that doesn't exist, it will generate an error. This also changes a parse warning to an error if the `=` is missing from BIN=ARG.
I intentionally did not bother to add the validation to config overrides, as it is a bit trickier to do, and that feature is very rarely used (AFAIK), and I'm uncertain if rustc-link-arg is really useful in that context.