11011 Commits

Author SHA1 Message Date
Eric Huss
0f5deb64f9 testsuite: Support anyhow error chains in error messages.
This is intended to help with adding more usage of anyhow in the
testsuite, which can help show context for errors.

This also includes some small improvements to the error messages to
provide more information.
2021-06-16 09:44:28 -07:00
Eric Huss
2021865d88 Remove some unused code. 2021-06-15 15:38:02 -07:00
bors
3b17193594 Auto merge of #9568 - hi-rustin:rustin-patch-error, r=alexcrichton
More information for links conflicting

close https://github.com/rust-lang/cargo/issues/9294
2021-06-14 14:14:55 +00:00
bors
44456677b5 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.)
2021-06-12 18:00:01 +00:00
Eric Huss
2492bf53ab 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.
2021-06-11 16:09:32 -07:00
Eric Huss
393077f968 Add run_json to Execs.
This is a helper to run the process and return a JSON object.
2021-06-11 16:07:20 -07:00
Eric Huss
3be34cb834 Remove "Expected: execs" from testsuite error.
That message was not helpful.
2021-06-11 15:25:50 -07:00
Eric Huss
0f304ca450 Fix verify_checks_output.
This was accidentally broken in
cc5e9df64a
causing it to not check in the error case (which is the only case that mattered).
2021-06-11 13:12:30 -07:00
Eric Huss
5d1b0f9c43 Switch cargo-test-support to anyhow. 2021-06-11 12:37:27 -07:00
bors
81537ee3f7 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.

cc `@pnkfelix`
2021-06-11 00:00:14 +00:00
Sunjay Varma
f68cdb9947 Change how the fix_deny_warnings_but_not_others test works to avoid breakage from new compiler suggestions 2021-06-10 16:49:29 -07:00
bors
c3a16b3431 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.
2021-06-10 16:12:42 +00:00
bors
da2c7705e4 Auto merge of #9561 - In-line:add-warning-for-ignored-arguments, r=ehuss
Implement warning for ignored trailing arguments
2021-06-10 15:47:52 +00:00
bors
e8855d69d6 Auto merge of #9569 - hi-rustin:rustin-patch-clippy, r=ehuss
Make clippy happy

It is already a reference.
2021-06-10 15:23:27 +00:00
bors
40b674cd11 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).

Fixes #8202
2021-06-10 14:15:18 +00:00
KubaP
c37a6e354d Add missing information to the man pages
Add the short missing description and build all of the manpages.
2021-06-10 10:37:01 +01:00
hi-rustin
657a24bf7d Make clippy happy 2021-06-10 15:14:52 +08:00
hi-rustin
724cf0f0eb More information for links conflicting 2021-06-10 15:12:19 +08:00
bors
b3475e6df9 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.
2021-06-10 02:55:53 +00:00
Eric Huss
9362fe5ff3 Update rustfix. 2021-06-09 18:13:56 -07:00
Eric Huss
47a02919cc Fix rustc/rustdoc config values to be config-relative paths. 2021-06-09 17:46:18 -07:00
Eric Huss
7b229bbe39 Move the rustc-echo-wrapper to be shared across tests.
This helps avoid rebuilding the same project several times.
2021-06-09 17:13:33 -07:00
KubaP
61282336ad Add mising information regarding cargo doc
It seems that the `--document-private-items` flag is automatically set when documenting a binary target.
2021-06-10 00:30:53 +01:00
bors
46ba901448 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](ed0c8c6d66/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 🤔

And thanks to `@ehuss` for taking the time to answer my questions and helping me through the contribution process, much appreciated

Closes #9536
2021-06-09 18:00:26 +00:00
Bryysen
da1c2f3b9c 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.

Closes #9536
2021-06-09 19:29:24 +02:00
bors
66686fd995 Auto merge of #9550 - hi-rustin:rustin-patch-feat, r=ehuss
add default_run to SerializedPackage

close https://github.com/rust-lang/cargo/issues/9497
2021-06-09 16:50:47 +00:00
bors
2544bd3418 Auto merge of #9522 - Aelnor:respect_user_choice_of_binlib, r=ehuss
respect user choice of lib/bin over heuristics

This one fixes #9333
2021-06-09 16:26:15 +00:00
bors
2b3af39167 Auto merge of #9547 - lu-zero:members_mut, r=alexcrichton
Add a mean to mutably access the members of a workspace

It is used by cargo-c to patch all the lib crates in a workspace.
2021-06-09 15:06:38 +00:00
Alik Aslanyan
e5d10f973d
Implement warning for ignored trailing arguments
in case built-in `cargo` command was invoked with `--`
2021-06-09 18:50:51 +04:00
bors
aa8b09297b 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.
2021-06-09 00:28:53 +00:00
hi-rustin
1abc4f2e8a Add test and update docs 2021-06-08 11:28:58 +08:00
bors
e21e03f4c0 Auto merge of #9556 - ehuss:gitignore-doc-fix, r=alexcrichton
Fix typo in gitignore docs.

`**.ext` is collapsed to `*.ext` by git.
2021-06-07 22:21:31 +00:00
Eric Huss
9efaaf1654 Fix typo in gitignore docs. 2021-06-07 15:11:56 -07:00
Luca Barbato
b26ceda7b0 Simplify Workspace::members()/default_members() 2021-06-07 20:58:39 +02:00
Luca Barbato
6fe08fa833 Add a mean to mutably access the members of a workspace
It is used by cargo-c to patch all the lib crates in a workspace.
2021-06-07 20:58:39 +02:00
bors
ed0c8c6d66 Auto merge of #9552 - taiki-e:typo, r=alexcrichton
Fix typos in command_prelude.rs
2021-06-07 14:28:06 +00:00
bors
11eec1d04d Auto merge of #9551 - hi-rustin:rustin-patch-clippy, r=alexcrichton
Make clippy happy

It is already a reference.
2021-06-07 14:00:09 +00:00
Taiki Endo
98df612f5f Fix typos in command_prelude.rs 2021-06-07 18:25:33 +09:00
hi-rustin
c971400330 Make test happy 2021-06-07 14:59:59 +08:00
hi-rustin
f9a5625733 add default_run to SerializedPackage
Delete "default_run": null,
2021-06-07 14:59:57 +08:00
hi-rustin
a71eb1b1ad Make clippy happy 2021-06-07 14:20:14 +08:00
bors
d3bc13288e Auto merge of #9546 - ehuss:fingerprint-dead-code, r=Eh2406
Remove some dead code.
2021-06-05 21:30:59 +00:00
Eric Huss
cc683fddc3 Remove some dead code. 2021-06-05 13:38:27 -07:00
bors
1a8692df11 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.
2021-06-05 17:21:05 +00:00
bors
71c1760bae 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.
2021-06-04 16:29:57 +00:00
David Tolnay
f5c2645899
Pull in semver 1.0.3 'x' fix 2021-06-04 09:19:15 -07:00
bors
1c36f7f7dc Auto merge of #9540 - ehuss:unstable-tracking, r=alexcrichton
Add some tracking issues to unstable docs.
2021-06-04 15:32:26 +00:00
bors
4ab971b4d0 Auto merge of #9538 - ehuss:docs-include-exclude, r=alexcrichton
Update documentation for include/exclude.

Closes #9502.
2021-06-04 15:05:30 +00:00
bors
b65a495aa6 Auto merge of #9534 - ehuss:mdbook-contrib, r=alexcrichton
Bump mdbook version for contrib guide.

Just bringing in a few small fixes.
2021-06-04 13:59:39 +00:00
Eric Huss
7fc95b2a0d Add some tracking issues to unstable docs. 2021-06-03 13:48:36 -07:00