bors [Tue, 22 Jun 2021 21:02:31 +0000 (21:02 +0000)]
Auto merge of #9574 - ehuss:weak-namespaced, r=alexcrichton
Unify weak and namespaced features.
This unifies weak and namespaced features in order to simplify the syntax and semantics. Previously there were four different ways to specify the feature of a dependency:
* `package-name/feature-name` — Enables feature `package-name` on self and enables `feature-name` on the dependency. (Today's behavior.)
* `package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled and will also activates a feature named `package-name` (which must be defined implicitly or explicitly).
* `dep:package-name/feature-name` — Enables dependency `package-name`, and enables `feature-name` on that dependency. This does NOT enable a feature named "package-name".
* `dep:package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled. This does NOT enable a feature named "package-name".
This changes it so there are only two:
* `package-name/feature-name` — Today's behavior.
* `package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled. This does NOT enable a feature named "package-name" (the same behavior as `dep:package-name?/feature-name` above).
This is a fairly subtle change, and in most cases probably won't be noticed. However, it simplifies things which helps with writing documentation and explaining how it works.
bors [Tue, 22 Jun 2021 19:27:25 +0000 (19:27 +0000)]
Auto merge of #9563 - ehuss:link-cdylib-warning, r=alexcrichton
Change `rustc-cdylib-link-arg` error to a warning.
In #9523, an error was added if `cargo:rustc-cdylib-link-arg` was issued in a build script without actually having a cdylib target. This uncovered that there was an unintentional change in #8441 to cause those link args to be applied to transitive dependencies.
This changes it so that the error is now a warning, with a note that this may become an error in the future. It also changes it so that the unstable `rustc-link-arg*` instructions only apply to the package that emitted them.
bors [Mon, 21 Jun 2021 17:51:53 +0000 (17:51 +0000)]
Auto merge of #9606 - ehuss:future-incompat-enhancements, r=alexcrichton
Updates to future-incompatible reporting.
This includes several changes to future-incompatible reports:
- Now able to retain multiple reports on disk (currently 5).
- `cargo report future-incompatibilities` will now show the last report without `--id`.
- Changed `cargo report future-incompatibilities` to display the report on stdout. Although these are "diagnostics", I see this more as a human-readable "report", which might benefit from being more easily piped (like to a pager). I also expect all other report subcommands to print to stdout.
- Fixed a bug where saving the reports to disk was not truncating the file. If multiple reports were saved, and future ones were *shorter* than a previous one, the on-disk structure would be corrupted.
- Reports are now always stored with ANSI escape codes, and the color filtering is done only when displayed.
- Some slight adjustments to the formatting of the report.
- When the wrong `--id` is passed, show available reports.
- Give a slightly better error message when there are no reports.
- Fixed bug where "0 dependencies has warnings" was unconditionally displayed (it should only be displayed if --future-incompat-report is used)
- Added `future-incompat` as an alias for the `future-incompatibilities` subcommand which can be quite a verbose command.
- When showing the note at the end of the build, make sure the list is unique (for example, if a single package had multiple targets that trigger a warning).
- Added a note at the bottom of the report that indicates if newer versions of a package are available.
bors [Mon, 21 Jun 2021 15:43:27 +0000 (15:43 +0000)]
Auto merge of #9602 - ehuss:diesel-warning, r=alexcrichton
Add a compatibility notice for diesel and the new resolver.
This adds a notice about a compatibility issue with diesel and the new feature resolver. This will display a notice if it detects the scenario where diesel causes a build error. It also prints a not when using `cargo fix --edition` when it detects a setup that may fail.
bors [Mon, 21 Jun 2021 15:09:41 +0000 (15:09 +0000)]
Auto merge of #9579 - wickerwaka:env-config-override, r=ehuss
Don't allow config env to modify vars set by cargo
This changes how the `[env]` variables are applied. They will no longer replace any variables that are being set by cargo itself, whether or not the `force` flag is set. The `force` flag still determines whether existing variables from the environment can be overridden or not.
bors [Mon, 21 Jun 2021 14:06:50 +0000 (14:06 +0000)]
Auto merge of #9604 - ehuss:is_symlink, r=alexcrichton
Disambiguate is_symlink.
`Path::is_symlink` was added in https://github.com/rust-lang/rust/pull/85747 which triggers the `unstable_name_collisions` lint, breaking Cargo's CI. This switches it to a free function to avoid the collision.
bors [Fri, 18 Jun 2021 20:57:46 +0000 (20:57 +0000)]
Auto merge of #9583 - rust-lang:dependabot/cargo/opener-0.5, r=ehuss
Update opener requirement from 0.4 to 0.5
Updates the requirements on [opener](https://github.com/Seeker14491/opener) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Seeker14491/opener/blob/master/CHANGELOG.md">opener's changelog</a>.</em></p>
<blockquote>
<h2>[0.5.0] - 2021-06-11</h2>
<h3>Added</h3>
<ul>
<li><code>open_browser()</code>, which uses the <code>$BROWSER</code> environment variable before falling back to <code>open()</code>.</li>
<li>WSL-specific implementation. Previously, WSL used the same implementation as Linux. Now the strategy on WSL is to use
the system's <code>wslview</code> command from <a href="https://github.com/wslutilities/wslu"><code>wslu</code></a> if available, falling back to the
system <code>xdg-open</code>, if available.</li>
</ul>
<h3>Changed</h3>
<ul>
<li>On Linux (non-WSL), the system <code>xdg-open</code> is now used if present. Otherwise, the bundled version is used, as before.</li>
<li>Avoid blocking the thread on Linux and WSL.</li>
</ul>
<h3>Removed</h3>
<ul>
<li><code>impl From<io::Error> for OpenError</code>.</li>
</ul>
<h2>[0.4.1] - 2019-09-30</h2>
<h3>Changed</h3>
<ul>
<li>Update <code>xdg-open</code>.</li>
</ul>
<h2>[0.4.0] - 2019-05-02</h2>
<h3>Added</h3>
<ul>
<li><code>OpenError</code> now implements <code>std::error::Error</code>.</li>
</ul>
<h3>Changed</h3>
<ul>
<li><code>OpenError</code>'s <code>failure::Fail</code> impl was removed from this crate, but the failure crate provides a blanket impl of
<code>failure::Fail</code> for types implementing <code>std::error::Error</code>, so this shouldn't break anything.</li>
</ul>
<h2>[0.3.0] - 2018-08-18</h2>
<h3>Added</h3>
<ul>
<li><code>stderr</code> field to <code>OpenError::ExitStatus</code> variant, which captures anything the failed process wrote to stderr.</li>
</ul>
<h2>[0.2.0] - 2018-08-08</h2>
<h3>Removed</h3>
<ul>
<li>The <code>open_sys</code> function, which was erroneously pub on non-Windows builds.</li>
</ul>
<h2>[0.1.0] - 2018-08-08</h2>
<ul>
<li>Initial release.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/Seeker14491/opener/commit/86e0a154d29a87fbde1dd2548ccb216f078951ee"><code>86e0a15</code></a> Fix Drakefile.ts</li>
<li><a href="https://github.com/Seeker14491/opener/commit/4261c2be991e5ebb1c2de296658cb6bdfabea3ed"><code>4261c2b</code></a> Release v0.5.0</li>
<li><a href="https://github.com/Seeker14491/opener/commit/5d24271a6512089d57cbf8dccf34bc419f918046"><code>5d24271</code></a> Revert command name in error type to <code>&'static str</code></li>
<li><a href="https://github.com/Seeker14491/opener/commit/9a36c6e656cd1100d81b0b37adb64a29bfa3dc91"><code>9a36c6e</code></a> Remove dependency on <code>wsl</code> crate</li>
<li><a href="https://github.com/Seeker14491/opener/commit/165b933775cc2a3ebd7818c6c23f813a86b920f0"><code>165b933</code></a> Avoid blocking</li>
<li><a href="https://github.com/Seeker14491/opener/commit/5c1e99a1c1a2dab3d49780116148c77b3be7d314"><code>5c1e99a</code></a> Update changelog</li>
<li><a href="https://github.com/Seeker14491/opener/commit/2da976eb48d44c1763128461a3547f8168bd60a0"><code>2da976e</code></a> Refactor <code>linux_and_more</code> module</li>
<li><a href="https://github.com/Seeker14491/opener/commit/f5c5564a9cfa17efb8e6d3e7115742818791795d"><code>f5c5564</code></a> Fix newline being included after WSL path conversion</li>
<li><a href="https://github.com/Seeker14491/opener/commit/bd30011d61476bb5d31f898d4127af38b18e15eb"><code>bd30011</code></a> [WSL] Try <code>wslview</code> first instead of second</li>
<li><a href="https://github.com/Seeker14491/opener/commit/e16875d7978f7bbb659dad7518c589813defa80b"><code>e16875d</code></a> Misc formatting changes</li>
<li>Additional commits viewable in <a href="https://github.com/Seeker14491/opener/compare/v0.4.1...v0.5.0">compare view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
bors [Fri, 18 Jun 2021 20:01:46 +0000 (20:01 +0000)]
Auto merge of #9586 - tmiasko:lines, r=alexcrichton
Avoid quadratic complexity when splitting output into lines
When searching for newlines in a process output keep track which part of
buffer was already examined to avoid processing the same data again and
again.
Tomasz Miąsko [Thu, 17 Jun 2021 00:00:00 +0000 (00:00 +0000)]
Avoid quadratic complexity when splitting output into lines
When searching for newlines in a process output keep track which part of
buffer was already examined to avoid processing the same data again and
again.
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.
dependabot[bot] [Mon, 14 Jun 2021 08:05:04 +0000 (08:05 +0000)]
Update opener requirement from 0.4 to 0.5
Updates the requirements on [opener](https://github.com/Seeker14491/opener) to permit the latest version.
- [Release notes](https://github.com/Seeker14491/opener/releases)
- [Changelog](https://github.com/Seeker14491/opener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Seeker14491/opener/compare/v0.4.1...v0.5.0)
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.