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.
Auto merge of #9751 - ehuss:remove-nbsp, r=alexcrichton
Remove nbsp characters.
Due to an accident due to the way I've been typing em-dash characters, a bunch of non-breaking space characters have snuck in to the source here. I never intended that, and I think having invisible characters that are not normal spaces can be confusing, so I just replaced them with spaces. There's still a few nbsp's where they are needed.
I was talking to someone who was confused about the [doc].browser value type as it related to using a path with a space in it, and it seemed like this area needed clarification in general.
Auto merge of #9727 - ehuss:fix-version, r=alexcrichton
Fix version string.
The version string for `cargo version` was inadvertently changed in #9657 so that it does not include the leading `cargo` as in `cargo 1.53.0 (4369396ce 2021-04-27)`.
Adds -p, --workspace, and --exclude to package and publish commands.
Uses ephemeral workspaces to avoid changing the existing functions too much.
There might be more `Finished dev [unoptimized + debuginfo] target` messages when packaging than there should be, I couldn't figure out what was generating them.
The tests aren't super extensive, as all the specs from arguments code should already be tested elsewhere.
Auto merge of #9557 - danielframpton:extra-link-args, r=ehuss
Stabilize the rustc-link-arg option
This change removes the unstable option (tracked by #9426) and unconditionally accepts additional linker arguments (as implemented in #7811 and #8441). Documentation is moved from unstable to what appeared to be the correct location.
I am not aware of any significant concerns with the option and it appears consistent with some other existing stable linker options.
Please let me know if this is not the appropriate process or if there is anything that I am missing from the PR.
Auto merge of #9653 - bjorn3:update_should_use_metadata, r=alexcrichton
Update should_use_metadata function
* Correct the reason for not renaming dylibs
* Add todo for -install-name/-soname usage
* Limit wasm32 executable metadata omission to emscripten. Wasm file don't contain any filename themself.
* Don't omit metadata for executables on macOS. backtrace-rs is now able to load debuginfo for renamed .dSYM files: https://github.com/rust-lang/backtrace-rs/blob/ed3689c2f2b9a31546d75fae389a32a572957dbd/src/symbolize/gimli/macho.rs#L51-L65
* Mention another reason to include the metadata hash for libstd.
Auto merge of #9714 - PTNobel:fix-force-warn, r=ehuss
Changes rustc argument from `--force-warns` to `--force-warn`
The rustc argument was renamed in rust-lang/rust#87346 breaking `cargo fix` on the nightly toolchain.
I encountered this while attempting to test Edition 2021 migrations.
I ran `RUSTC=/path/to/nightly/rustc cargo test` and encountered a few failing tests, but none of them seemed at all related to the 1 line I changed, so if they crop up in CI as well, would love some help on identifying what's causing that.
Auto merge of #9632 - weihanglo:issue-6691, r=ehuss
Display registry name instead of registry URL when possible
Fixes #6691
This PR can be divided into several parts:
- c5be3de: Try to display registry names instead of URLs for `impl Dipslay for SourceId`. This benefits almost all kinds of messages using`SourceId` directly or indrectly.
- 9394d48: This fixes `Updating <name> index` part of `[source]` replacement, which previously didn't preserve the registry name information.
- 4c2f9b5: This makes its best effort to show registry names for deps from `Cargo.lock`. Since current lockfile format does not serialize any registry name. We here try the best effort to restore registry name from either `[registries]` table or `[source]` replacement table. This is done by manually implementing `Hash` and `PartialEq` for `SourceIdInner`, of which two traits previously are simply derived.
To make `SourceIdInner` generate the same hash no matter it contains `name` field or not, here we remove `name` field from hashing and only concern about `kind`, `precise` and `canonical_url`.
Feel free to ask me for adding more tests, though I am not sure what tests should be added 😅
Weihang Lo [Sun, 27 Jun 2021 16:28:39 +0000 (00:28 +0800)]
Show registry name for SourceId from lockfile
Since current lockfile does not serialize any registry names. We here
try best effort to restore registry name from either `[registries]`
table or `[source]` replacement table. This is done by manually
implementing `Hash` and `PartialEq` for `SourceIdInner`, of which two
traits previously are simply `derive`d.
To make `SourceIdInner` generate the same hash whether contains `name`
field or not, here we remove `name` field from hashing and only concern
about `kind`, `precise` and `canonical_url`.
Auto merge of #9685 - ehuss:named-profile-updates, r=alexcrichton
Named profile updates
A few updates for named profiles to push them closer to stabilization:
- Disable the `dir-name` profile setting. `dir-name` primarily exists for translating the built-in profiles or sharing artifacts between profiles. In order to simplify the UI, we would like to not expose it to the user for the initial stabilization. The code to support it is kept in case we want to add it in the future.
- Reserve some profile names. Just to give a little flexibility in the future in case we want to use these, or that they could cause confusion. Also updated the error text a little.
- Add support for custom profiles to legacy commands. Their old behavior is still retained for backwards compatibility. That is:
* `cargo check`
* `--profile=test`: This forces the test mode. For example, `cargo check --lib --profile=test` will check the library as a unit test (with `--test`).
* `cargo fix`
* `--profile=test`: Forces test mode, same as above.
* `cargo rustc`
* `--profile=test`: Forces test mode, same as above.
* `--profile=bench`: Forces bench mode.
* `--profile=check`: Forces check mode.
- These commands also allow mixing the above options with `--release`, which is normally not allowed.
- Fix `cargo bench` to support the `--profile` option. I think it was just forgotten.
Auto merge of #9703 - djmitche:versionprefs, r=alexcrichton
Factor version preferences into a struct
This concentrates all of the "prefer this version" logic previously
handled with `try_to_use` and `prefer_patch_deps` parameters into a
struct that hides both the reason a package version might be preferred
and the form that preference took (Dependency or PackageId). Besides
simplifying `RegistryQuerier::query` slightly, this invites further
refinements to version preferences to support new cargo features.
This concentrates all of the "prefer this version" logic previously
handled with `try_to_use` and `prefer_patch_deps` parameters into a
struct that hides both the reason a package version might be preferred
and the form that preference took (Dependency or PackageId). Besides
simplifying `RegistryQuerier::query` slightly, this invites further
refinements to version preferences to support new cargo features.
Auto merge of #9675 - ehuss:diagnostic-dedupe, r=alexcrichton
Deduplicate compiler diagnostics.
This adds some logic to deduplicate diagnostics emitted across rustc invocations. There are some situations where different targets can emit the same message, and that has caused confusion particularly for new users. A prominent example is running `cargo test` which will build the library twice concurrently (once as a normal library, and once as a test).
As part of this, the "N warnings emitted" message sent by rustc is intercepted, and instead cargo generates its own summary. This is to prevent potentially confusing situations where that message is either deduplicated, or wrong. It also provides a little more context to explain exactly *what* issued the warnings. Example:
```warning: `foo` (lib) generated 1 warning```
This only impacts human-readable output, it does not change JSON behavior.
Auto merge of #9698 - ehuss:enable-future-incompat, r=alexcrichton
Re-enable future-incompatible tests.
This re-enables the future-incompatible tests that were disabled in #9638.
rustc now has a `-Zfuture-incompat-test` flag we can use to test the future-incompatible reporting system. It causes rustc to treat every lint as future-incompatible, so we can just pick some arbitrary lint that should be stable over time.
Auto merge of #9680 - inquisitivecrystal:doc-alias, r=ehuss
Add `d` as an alias for `doc`
I expected that this alias would already exist. `doc` feels to me like the other commands that currently have aliases. `build`, `check`, `run`, and `test` are all modes of using the existing repository, and are all things one might run at least somewhat frequently during development. There is no other built in cargo subcommand that starts with `d`, so this also has the virtue of being pretty unambiguous.
Auto merge of #9694 - ehuss:edition-fix-latest, r=alexcrichton
`cargo fix --edition`: extend warning when on latest edition
This extends the warning issued when `cargo fix --edition` is run when the user is already on the latest edition. Before #9184, there were instructions on what to do, but those probably should not have been completely removed. It seems likely that some users may get the steps out of order, so this hopefully tries to explain them clearly.
Auto merge of #9688 - rust-lang:dependabot/cargo/env_logger-0.9.0, r=alexcrichton
Update env_logger requirement from 0.8.1 to 0.9.0
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/env-logger-rs/env_logger/releases">env_logger's releases</a>.</em></p>
<blockquote>
<h2>v0.9.0</h2>
<p>Breaking Changes:</p>
<ul>
<li>Default message format now prints the target instead of the module</li>
</ul>
<p>Improvements:</p>
<ul>
<li>Added a method to print the module instead of the target</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/04856ac38baf422baebb40729cf51127a75b82ed"><code>04856ac</code></a> bump version to 0.9.0</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/e4744ff41a2e249bd94511c4689b4dbaa915841f"><code>e4744ff</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/env-logger-rs/env_logger/issues/209">#209</a> from gtsiam/main</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/c5fa7a2c2d9ad3f5d2da0581ede4ab2e8944e104"><code>c5fa7a2</code></a> refactor: fix clippy warnings</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/34574dfa13e2c81bab007715c2f6faa4b94bb67f"><code>34574df</code></a> Update link to examples</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/18884971d4eb1c268d61a4c37747de692bdd7124"><code>1888497</code></a> Clarified documentation about log filtering</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/365ffafe45f615f65b88d67834aab16b132d9ecc"><code>365ffaf</code></a> Show target instead of module path by default</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/d2998a6ec685051b97f5b5c97427a61593bc6581"><code>d2998a6</code></a> Add option to print log target</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/13cafce572362582f57964eae6cb4a41f52fd04a"><code>13cafce</code></a> Bump version to 0.8.4</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/090081156127dcd896b8b00837549cb4008c43d0"><code>0900811</code></a> Ensure unique directive names when building filters</li>
<li><a href="https://github.com/env-logger-rs/env_logger/commit/1a8379a533f043e623d5eb4a898d171927ad61c1"><code>1a8379a</code></a> Allow writing logs to a custom output target (Target::Pipe)</li>
<li>Additional commits viewable in <a href="https://github.com/env-logger-rs/env_logger/compare/v0.8.1...v0.9.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)
Auto merge of #9674 - iankronquist:patch-1, r=alexcrichton
Document cargo limitation w/ workspaces & configs
This behavior is described in this bug:
https://github.com/rust-lang/cargo/issues/2930
I think we should document limitations of the tool which exist at present if they do not bind our hands in the future.
If this bug is fixed, this note should be removed.
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.1...v0.9.0)
Auto merge of #9663 - nebkor:master, r=alexcrichton
Add format option to `cargo tree` to print the lib_name
Adds a way to have `cargo tree` display the name of the library inside a package dependency, which can differ from the name of the package. Updates the `tree::format` test to test for its proper behavior.
Auto merge of #9639 - djmitche:issue9535, r=Eh2406
Prefer patched versions of dependencies
When selecting among several versions of a paackage, prefer versions
from `[patch]` sections over other versions, similar to how locked
versions are preferred.
Patches come in the form of a Dependency and not a PackageId, so this
preference is expressed with `prefer_patch_deps`, distinct from
`try_to_use`.
Auto merge of #9665 - gilescope:giles-better-message, r=alexcrichton
Spot the crate typo easily
ego tweak to make it easy to spot typos:
Before:
```
error: no matching package named `sc-consensus-primitivies` found
location searched: /Users/bit/p/substrate1/client/primitives/consensus/common
perhaps you meant: sc-consensus-primitives
required by package `sc-network v0.9.0 (/Users/bit/p/substrate1/client/network)`
```
After:
```
error: no matching package named `sc-consensus-primitivies` found
perhaps you meant: sc-consensus-primitives
location searched: /Users/bit/p/substrate1/client/primitives/consensus/common
required by package `sc-network v0.9.0 (/Users/bit/p/substrate1/client/network)`
```
Eric Huss [Tue, 13 Jul 2021 22:22:09 +0000 (15:22 -0700)]
Support custom profiles in legacy commands.
This makes the following changes:
- Allows `cargo check`, `cargo fix`, and `cargo rustc` to support custom
named profiles. This retains the legacy behavior of those commands.
- Fixes `cargo bench` so that it supports custom named profiles.
Eric Huss [Tue, 13 Jul 2021 18:59:15 +0000 (11:59 -0700)]
Reserve some names for named profiles.
Just to give a little flexibility in the future in case we want to use
these, or that they could cause confusion. Also updated the error text a
little.
Eric Huss [Tue, 13 Jul 2021 15:21:27 +0000 (08:21 -0700)]
Disable the dir-name profile setting.
dir-name primarily exists for translating the built-in profiles. In
order to simplify the UI, we would like to not expose it to the user for
the initial stabilization. The code to support it is kept in case we
want to add it in the future.