]> git.proxmox.com Git - cargo.git/log
cargo.git
2 years agoAdd some more information to verbose version.
Eric Huss [Fri, 8 Oct 2021 19:19:24 +0000 (12:19 -0700)]
Add some more information to verbose version.

2 years agoAuto merge of #9938 - weihanglo:issue-9857, r=ehuss
bors [Thu, 7 Oct 2021 20:06:39 +0000 (20:06 +0000)]
Auto merge of #9938 - weihanglo:issue-9857, r=ehuss

Skip all `cargo fix` that tends to write to registry cache.

Skip all `cargo fix` that tends to write to registry cache.

This is a temporary hack for #9857. The real fix may need to touch rustc.

2 years agoAuto merge of #9943 - ehuss:stabilize-named-profiles, r=alexcrichton
bors [Thu, 7 Oct 2021 17:42:56 +0000 (17:42 +0000)]
Auto merge of #9943 - ehuss:stabilize-named-profiles, r=alexcrichton

Stabilize named profiles

This stabilizes the named profiles feature. As an overview of what this does, it allows specifying custom named profiles, such as:

```toml
[profile.release-lto]
inherits = "release"
lto = true
```

And enables the use of the `--profile` CLI option to choose a profile by name.

Another key change here is that cargo now only uses a single profile per command. Previously, some commands such as `cargo test` would use a mix of profiles based on which package and target were being built.

### Summary of new behavior

* Profiles can now have arbitrary names. New profiles require the `inherits` key.
* The `--profile` flag is now available on all build commands.
* The `CompileMode` is no longer considered for choosing the profile, only one profile will be used. Previously, building a test, benchmark, or doctest would use the test or bench profile, and all dependencies would use the dev/release profiles. This change is done to arguably make it easier to understand, and to possibly give more desired and intuitive behavior.
* The `test` profile now inherits settings from the `dev` profile (and `bench` from `release`).

### Deviations from the original RFC and implementation

* The original RFC indicated that `--all-targets` without `--profile` would retain the old behavior where it would use different profiles for different targets. However, the implementation uses a single profile, to avoid confusion and to keep things simple.
* The `dir-name` key is not exposed to the user. The implementation is retained to handle mapping of built-in profile names (test/dev→debug, bench→release). This can be exposed in the future if necessary.

### Notes about this PR

* Fixed an issue where the duplicate package override check would randomly return matches for inherited profiles like `test`.
* I left some of the old, vestigial code behind to possibly make it easier to revert this PR if necessary. If this does land, I think it can be eventually removed (code using `Feature::named_profiles` and various things using `named_profiles_enabled`).
* Added `target` to reserved list, just because.
* Adds a warning if `--release` is combined with `--profile` in `cargo rustc`, `check`, or `fix`. The `--release` flag was being ignored.

### Hazards and concerns

* This has had very little real-world testing.
* Custom profile directories may conflict with other things in the `target` directory. We have reserved profile names that currently conflict (such as `doc` or `package`). However, they can still collide with target names. This also presents a hazard if Cargo ever wants to add new things to that top directory. We decided to proceed with this because:
    * We currently have no plans to add new built-in profiles.
    * We have reserved several profile names (including anything starting with "cargo"), and the profile name syntax is deliberately limited (so cargo is still free to add `.` prefixed hidden directories).
    * A user creating a profile that collides with a target name resides in the "don't do that" territory. Also, that shouldn't be catastrophic, as the directories are still somewhat organized differently.
* Artifacts may no longer be shared in some circumstances. This can lead to substantially increased `target` directory sizes (and build times), particularly if the `test` profile is not the same as the `dev` profile. Previously, dependencies would use the `dev` profile for both. If the user wants to retain the old behavior, they can use an override like `[profile.test.package."*"]` and set the same settings as `dev`.
* This may break existing workflows. It is possible, though unlikely, that changes to the profile settings will cause changes to how things build in such a way to break behavior.
    * Another example is using something like `cargo build` to prime a cache that is used for `cargo test`, and there is a custom `test` profile, the cache will no longer be primed.
* The legacy behavior with `cargo rustc`, `cargo check`, and `cargo fix` may be confusing. We may in the future consider something like a `--mode` flag to formalize that behavior.
* The `PROFILE` environment variable in build scripts may cause confusion or cause problems since it only sets `release` or `debug`. Some people may be using that to determine if `--release` should be used for a recursive `cargo` invocation. Currently I noted in the documentation that it shouldn't be used. However, I think it could be reasonable to maybe add a separate environment variable (`PROFILE_NAME`?) that exposes the actual profile used. We felt that changing the existing value could cause too much breakage (and the mapping of debug→dev is a little awkward).

Closes #6988

2 years agoAuto merge of #9963 - ehuss:update-git2, r=alexcrichton
bors [Thu, 7 Oct 2021 01:21:50 +0000 (01:21 +0000)]
Auto merge of #9963 - ehuss:update-git2, r=alexcrichton

Update git2

This is just a regular update, updating from libgit2 1.1.0 to 1.3.0.

2 years agoUpdate git2
Eric Huss [Wed, 6 Oct 2021 23:04:41 +0000 (16:04 -0700)]
Update git2

2 years agoAuto merge of #9847 - weihanglo:issue-9840, r=Eh2406
bors [Tue, 5 Oct 2021 18:16:42 +0000 (18:16 +0000)]
Auto merge of #9847 - weihanglo:issue-9840, r=Eh2406

Distinguish lockfile version req from normal dep in resolver error message

Resolves #9840

This PR adds a new variant `OptVersionReq::Locked` as #9840 described.
The new variant represents as a locked version requirement that contains
an exact locked version and the original version requirement.

Previously we use exact version req to synthesize locked version req.
Now we make those need a truly locked to be `OptVersionReq::Locked`,
including:

- `[patch]`: previous used exact version req to emulate locked version,
  and it only need to lock dep version but not source ID, so we make
  an extra method `Dependency::lock_version` for it.
- Dependencies from lock files: No need to change the call site.

2 years agoLock `[replace]` source as well
Weihang Lo [Tue, 5 Oct 2021 17:16:00 +0000 (01:16 +0800)]
Lock `[replace]` source as well

2 years agoAuto merge of #9954 - gilescope:lev_tighten, r=ehuss
bors [Sat, 2 Oct 2021 15:52:22 +0000 (15:52 +0000)]
Auto merge of #9954 - gilescope:lev_tighten, r=ehuss

nit: Allocated slightly bigger vec than needed

I think this is slightly more correct as the rest of the algorithm is focusing on chars not bytes, so this is more consistent.

2 years agocargo fmt
Giles Cope [Sat, 2 Oct 2021 09:06:36 +0000 (10:06 +0100)]
cargo fmt

2 years agoA little more correct.
Giles Cope [Sat, 2 Oct 2021 08:58:11 +0000 (09:58 +0100)]
A little more correct.

2 years agoAuto merge of #9951 - relrelb:completion, r=alexcrichton
bors [Fri, 1 Oct 2021 16:59:58 +0000 (16:59 +0000)]
Auto merge of #9951 - relrelb:completion, r=alexcrichton

Add shell completion for shorthand commands

Currently `cargo` has shell completion for most (if not all) builtin commands such as `build`, `run`, `check` etc.
However, it doesn't have shell completion for the short forms of these commands, such as `b`, `r`, `c` etc.

This PR adds both bash and zsh completions for command shorthands.

Fixes #9086.

2 years agoAdd shell completion for shorthand commands
relrelb [Fri, 1 Oct 2021 08:14:45 +0000 (11:14 +0300)]
Add shell completion for shorthand commands

Currently `cargo` has shell completion for most (if not all) builtin
commands such as `build`, `run`, `check` etc.
However, it doesn't have shell completion for the short forms of these
commands, such as `b`, `r`, `c` etc.

This commit adds both bash and zsh completions for command shorthands.

Fixes #9086.

2 years agoAuto merge of #9945 - ehuss:update-precise-metadata, r=alexcrichton
bors [Mon, 27 Sep 2021 13:44:18 +0000 (13:44 +0000)]
Auto merge of #9945 - ehuss:update-precise-metadata, r=alexcrichton

Allow `cargo update --precise` with metadata.

`cargo update --precise` would require that the version matches *exactly*, including build metadata.  Usually the build metadata is ignored (like in dependency declarations), but in this circumstance it isn't.  This can be awkward in some cases where it can be more convenient to type just the version number without the build metadata.

This changes it so that if the metadata isn't provided, then it will be ignored when matching.  Otherwise, it will be honored. This is slightly different from a version requirement like `=1.2.3+foo` which ignores the metadata completely.

This also adds a slightly better error message if you don't type in valid syntax for a version number (previously it would just emit the `no matching package` error).

2 years agoAuto merge of #9866 - nipunn1313:pkg_in_repo2, r=ehuss
bors [Sun, 26 Sep 2021 19:35:27 +0000 (19:35 +0000)]
Auto merge of #9866 - nipunn1313:pkg_in_repo2, r=ehuss

Support path_in_vcs as part of cargo_vcs_metadata

Depends on #9865 - this PR will look simpler once that one lands. I can't target my PR to the base branch of #9865 as an external contributor (since it's in my fork). For now just review the latest commit of this one.

This is a backward compatible change that is an alternative to #9837

2 years agoSupport path_in_vcs as part of cargo_vcs_metadata
Nipunn Koorapati [Thu, 2 Sep 2021 06:12:39 +0000 (02:12 -0400)]
Support path_in_vcs as part of cargo_vcs_metadata

2 years agoAuto merge of #9948 - weihanglo:issue-9940, r=ehuss
bors [Sun, 26 Sep 2021 15:48:16 +0000 (15:48 +0000)]
Auto merge of #9948 - weihanglo:issue-9940, r=ehuss

Doc about InstallTracker files and `install.root`

resolves #9940

2 years agoTweak wording for config.md
Weihang Lo [Sun, 26 Sep 2021 15:36:26 +0000 (23:36 +0800)]
Tweak wording for config.md

Co-authored-by: Eric Huss <eric@huss.org>
2 years agoDoc about InstallTracker files and `install.root`
Weihang Lo [Sun, 26 Sep 2021 10:52:08 +0000 (18:52 +0800)]
Doc about InstallTracker files and `install.root`

2 years agoAllow `cargo update --precise` with metadata.
Eric Huss [Sat, 25 Sep 2021 17:09:13 +0000 (10:09 -0700)]
Allow `cargo update --precise` with metadata.

2 years agoAdd future compatibility warning on mixture of --release with --profile.
Eric Huss [Fri, 24 Sep 2021 17:59:00 +0000 (10:59 -0700)]
Add future compatibility warning on mixture of --release with --profile.

This was historically allowed, but it silently ignores the --release flag.

2 years agoReserve the "target" profile name.
Eric Huss [Fri, 24 Sep 2021 17:04:00 +0000 (10:04 -0700)]
Reserve the "target" profile name.

Just in case we want to use it later.

2 years agoStabilize named profiles.
Eric Huss [Fri, 24 Sep 2021 04:55:42 +0000 (21:55 -0700)]
Stabilize named profiles.

2 years agoSkip all `cargo fix` that tends to write to registry cache.
Weihang Lo [Wed, 22 Sep 2021 14:33:24 +0000 (22:33 +0800)]
Skip all `cargo fix` that tends to write to registry cache.

2 years agoAuto merge of #9941 - ehuss:license-warning, r=Eh2406
bors [Thu, 23 Sep 2021 04:07:34 +0000 (04:07 +0000)]
Auto merge of #9941 - ehuss:license-warning, r=Eh2406

Add some clarity on the license/license-file warning.

As noted in #8537, there is some confusion about why license and license-file are mutually exclusive. This attempts to add some detail to the warning.

2 years agoAuto merge of #9933 - QiangHeisenberg:help, r=ehuss
bors [Thu, 23 Sep 2021 03:33:28 +0000 (03:33 +0000)]
Auto merge of #9933 - QiangHeisenberg:help, r=ehuss

Fix the problem that help cannot be displayed properly

close #9883

2 years agoAdd some clarity on the license/license-file warning.
Eric Huss [Thu, 23 Sep 2021 03:26:40 +0000 (20:26 -0700)]
Add some clarity on the license/license-file warning.

2 years agoAuto merge of #9939 - syohex:zsh-example-completion, r=ehuss
bors [Wed, 22 Sep 2021 16:08:27 +0000 (16:08 +0000)]
Auto merge of #9939 - syohex:zsh-example-completion, r=ehuss

Implement example completion for zsh

Related issue #8871

#### Demo

![cargo_example_complete](https://user-images.githubusercontent.com/554281/134369988-c1d1d83e-0d61-4b8f-9b1d-ca5ca75e3723.gif)

2 years agoAuto merge of #9937 - alexcrichton:bump-curl, r=ehuss
bors [Wed, 22 Sep 2021 15:35:06 +0000 (15:35 +0000)]
Auto merge of #9937 - alexcrichton:bump-curl, r=ehuss

Bump curl-sys dependency

Brings in curl 7.79.1

2 years agoImplement example completion for zsh
Shohei YOSHIDA [Wed, 22 Sep 2021 15:03:06 +0000 (00:03 +0900)]
Implement example completion for zsh

2 years agoAuto merge of #9921 - ehuss:fetch-smoke, r=alexcrichton
bors [Wed, 22 Sep 2021 13:45:01 +0000 (13:45 +0000)]
Auto merge of #9921 - ehuss:fetch-smoke, r=alexcrichton

Add fetch smoke test.

This adds a test with a statically built curl to check if running `cargo fetch` works.  This adds a few minutes to CI time, but I think it is worthwhile to try to catch some regressions.

Note that macOS uses system curl to match the rust-lang/rust build mode.

2 years agoBump curl-sys dependency
Alex Crichton [Wed, 22 Sep 2021 13:22:36 +0000 (06:22 -0700)]
Bump curl-sys dependency

Brings in curl 7.79.1

2 years agoAuto merge of #9934 - ehuss:progress-test, r=alexcrichton
bors [Wed, 22 Sep 2021 13:14:21 +0000 (13:14 +0000)]
Auto merge of #9934 - ehuss:progress-test, r=alexcrichton

Differentiate tests in progress bar.

Some people have expressed confusion when the progress bar includes the package name twice, such as:

```
Building [=======================> ] 301/307: rustc_interface, rustc_interface
```

This can happen in a variety of circumstances, but a common one is `cargo test`. This causes the library to be built in parallel with the library being built for unittests. This PR adds some additional markers to differentiate what is being built:

- Lib as test: `lib_name(test)`
- Binary as test: `bin_name(bin test)`
- Example as test: `example_name(example test)`

2 years agoadd test
l00556901 [Wed, 22 Sep 2021 03:36:08 +0000 (11:36 +0800)]
add test

2 years agofix error
l00556901 [Wed, 22 Sep 2021 03:08:32 +0000 (11:08 +0800)]
fix error

2 years agofmt&Update Code
l00556901 [Wed, 22 Sep 2021 02:58:16 +0000 (10:58 +0800)]
fmt&Update Code

2 years agoDifferentiate tests in progress bar.
Eric Huss [Wed, 22 Sep 2021 02:38:27 +0000 (19:38 -0700)]
Differentiate tests in progress bar.

2 years agoMerge branch 'master' of https://github.com/rust-lang/cargo into help
l00556901 [Wed, 22 Sep 2021 02:28:16 +0000 (10:28 +0800)]
Merge branch 'master' of https://github.com/rust-lang/cargo into help

* 'master' of https://github.com/rust-lang/cargo: (21 commits)
  Remove TOML incompatibility hacks
  Use a more compact way to compare versions
  Remove broken link in contrib docs.
  Change diesel compatibility messages
  Temporarily revert curl-sys update.
  Update curl-sys
  Bump Cargo's curl requirement to 7.79.0
  Revert "When a dependency does not have a version, git or path, fails directly"
  Fix warnings from better precision of `dead_code` lint
  Improve "wrong output" error.
  Add some contributor docs for debugging testsuite tests.
  Fix warnings when documenting with `--document-private-items`
  Update changelog for 1.56
  Bump to 0.58.0
  Fix rustc --profile=dev unstable check.
  config.md: fix typo
  Enable some tests on windows.
  Fix `cargo fix --edition` on stable.
  Enable strip test on macos.
  Remove log
  ...

2 years agoFix the problem that help cannot be displayed properly
l00556901 [Wed, 22 Sep 2021 02:16:22 +0000 (10:16 +0800)]
Fix the problem that help cannot be displayed properly

2 years agoAuto merge of #9932 - epage:hacks, r=alexcrichton
bors [Tue, 21 Sep 2021 20:34:24 +0000 (20:34 +0000)]
Auto merge of #9932 - epage:hacks, r=alexcrichton

Remove TOML incompatibility hacks

- `set_require_newline_after_table` was added in #2680 back in 2016
- `set_allow_duplicate_after_longer_table` was added in #6761 in 2019

Several years later, this PR is turning these warnings into errors.

The function and documentation was kept so we can add additional hacks
in the future, like if we switch TOML parsers.

2 years agoRemove TOML incompatibility hacks
Ed Page [Tue, 21 Sep 2021 19:48:18 +0000 (14:48 -0500)]
Remove TOML incompatibility hacks

- `set_require_newline_after_table` was added in #2680 back in 2016
- `set_allow_duplicate_after_longer_table` was added in #6761 in 2019

Several years later, this PR is turning these warnings into errors.

The function and documentation was kept so we can add additional hacks
in the future, like if we switch TOML parsers.

2 years agoAuto merge of #9927 - weiznich:diesel_2021_edition, r=ehuss
bors [Tue, 21 Sep 2021 15:24:03 +0000 (15:24 +0000)]
Auto merge of #9927 - weiznich:diesel_2021_edition, r=ehuss

Change diesel compatibility messages

Diesel 1.4.8 fixes the critical behaviour. This commit changes the
corresponding messages for `cargo fix` and normal builds to prompt the
user to just update the diesel version to fix the corresponding
compilation errors.

As discussed in https://github.com/rust-lang/rust/issues/88903#issuecomment-923061946

Fixes https://github.com/rust-lang/rust/issues/88903
Fixes #9450

2 years agoAuto merge of #9928 - ehuss:contrib-githelp, r=alexcrichton
bors [Tue, 21 Sep 2021 14:30:57 +0000 (14:30 +0000)]
Auto merge of #9928 - ehuss:contrib-githelp, r=alexcrichton

Remove broken link in contrib docs.

I don't think this point is particularly important, so I'm just removing it.

2 years agoUse a more compact way to compare versions
Georg Semmler [Tue, 21 Sep 2021 07:05:51 +0000 (09:05 +0200)]
Use a more compact way to compare versions

2 years agoRemove broken link in contrib docs.
Eric Huss [Mon, 20 Sep 2021 21:43:30 +0000 (14:43 -0700)]
Remove broken link in contrib docs.

I don't think this point is particularly important, so I'm just removing it.

2 years agoChange diesel compatibility messages
Georg Semmler [Mon, 20 Sep 2021 19:20:26 +0000 (21:20 +0200)]
Change diesel compatibility messages

Diesel 1.4.8 fixes the critical behaviour. This commit changes the
corresponding messages for `cargo fix` and normal builds to promt the
user to just update the diesel version to fix the corresponding
compilation errors.

2 years agoCompare version fields' equalities directly
Weihang Lo [Mon, 20 Sep 2021 03:31:41 +0000 (11:31 +0800)]
Compare version fields' equalities directly

Instead of creating another VersionReq, this can reduce some extra
efforts on version matching logic. Though it also may introduces
divergence from semver's matching logic. Accordingly, we borrow unit
tests from semver crate and compare the matching results to prevent
future breaks.

2 years agoShow original version_req for locked dependency
Weihang Lo [Fri, 27 Aug 2021 16:17:39 +0000 (00:17 +0800)]
Show original version_req for locked dependency

When encounter resolver error with locked dependency, we now show
original version req along with the exact locked version.

2 years agoUpdate synthetic locked version_req to real locked
Weihang Lo [Fri, 27 Aug 2021 16:11:14 +0000 (00:11 +0800)]
Update synthetic locked version_req to real locked

Previously we use exact semver version req to synthesize locked version
req. Now we make those need a truly locked to be `OptVersionReq::Locked`.

2 years agoAdd `Locked` variant for `OptVersionReq`
Weihang Lo [Fri, 27 Aug 2021 15:58:11 +0000 (23:58 +0800)]
Add `Locked` variant for `OptVersionReq`

`OptVersionReq::Locked` stores the original version requirement and the
acutal locked version. This makes error message describing more precise.

2 years agoAdd fetch smoke test.
Eric Huss [Sun, 19 Sep 2021 01:10:16 +0000 (18:10 -0700)]
Add fetch smoke test.

2 years agoMerge pull request #9920 from ehuss/revert-curl-sys
Alex Crichton [Sat, 18 Sep 2021 20:42:28 +0000 (15:42 -0500)]
Merge pull request #9920 from ehuss/revert-curl-sys

Temporarily revert curl-sys update.

2 years agoTemporarily revert curl-sys update.
Eric Huss [Sat, 18 Sep 2021 19:42:48 +0000 (12:42 -0700)]
Temporarily revert curl-sys update.

2 years agoAuto merge of #9917 - ehuss:update-curl-sys, r=alexcrichton
bors [Fri, 17 Sep 2021 13:51:54 +0000 (13:51 +0000)]
Auto merge of #9917 - ehuss:update-curl-sys, r=alexcrichton

Update curl-sys

Updates to 0.4.47 to bring in https://github.com/alexcrichton/curl-rust/pull/406.

2 years agoUpdate curl-sys
Eric Huss [Fri, 17 Sep 2021 10:04:06 +0000 (03:04 -0700)]
Update curl-sys

2 years agoAuto merge of #9914 - alexcrichton:bump-curl, r=ehuss
bors [Wed, 15 Sep 2021 15:11:44 +0000 (15:11 +0000)]
Auto merge of #9914 - alexcrichton:bump-curl, r=ehuss

Bump Cargo's curl requirement to 7.79.0

Brings in the latest release of `curl`

2 years agoBump Cargo's curl requirement to 7.79.0
Alex Crichton [Wed, 15 Sep 2021 14:39:25 +0000 (07:39 -0700)]
Bump Cargo's curl requirement to 7.79.0

Brings in the latest release of `curl`

2 years agoAuto merge of #9911 - rust-lang:revert-9686-rustin-patch-error, r=alexcrichton
bors [Tue, 14 Sep 2021 20:20:30 +0000 (20:20 +0000)]
Auto merge of #9911 - rust-lang:revert-9686-rustin-patch-error, r=alexcrichton

Revert "When a dependency does not have a version, git or path, fails directly"

Reverts rust-lang/cargo#9686

We discussed, and felt like this change wasn't all that important, and a few people have mentioned that it caused problems for them.

Closes #9885

2 years agoRevert "When a dependency does not have a version, git or path, fails directly"
Eric Huss [Tue, 14 Sep 2021 20:04:03 +0000 (13:04 -0700)]
Revert "When a dependency does not have a version, git or path, fails directly"

2 years agoAuto merge of #9904 - ehuss:contrib-debug-test, r=alexcrichton
bors [Mon, 13 Sep 2021 19:09:16 +0000 (19:09 +0000)]
Auto merge of #9904 - ehuss:contrib-debug-test, r=alexcrichton

Add some contributor docs for debugging testsuite tests.

This adds some suggestions on how to debug testsuite tests.

Closes #9757

2 years agoAuto merge of #9903 - jyn514:rustdoc-warnings, r=alexcrichton
bors [Mon, 13 Sep 2021 18:38:16 +0000 (18:38 +0000)]
Auto merge of #9903 - jyn514:rustdoc-warnings, r=alexcrichton

Fix warnings when documenting with `--document-private-items`

- Use hyperlinks for URLs
- Fix broken intra-doc links

This doesn't fix the following warning, since I wasn't sure what change
was appropriate:
```
warning: public documentation for `rustc_process` links to private item `self::core::compiler::Context::primary_packages`
   --> src/cargo/core/compiler/compilation.rs:164:22
    |
164 |     /// flag), see [`crate::core::compiler::Context::primary_packages`].
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this item is private
    |
    = note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
    = note: this link resolves only because you passed `--document-private-items`, but will break without
```

To avoid noise, this doesn't add an `allow` either.

2 years agoAuto merge of #9905 - ehuss:wrong-output-error, r=alexcrichton
bors [Mon, 13 Sep 2021 18:07:19 +0000 (18:07 +0000)]
Auto merge of #9905 - ehuss:wrong-output-error, r=alexcrichton

Improve "wrong output" error.

The error message for an improperly formatted build script output was a bit abrupt and unhelpful.  This adds some more details to the error message.

2 years agoAuto merge of #9906 - camelid:fix-warnings, r=alexcrichton
bors [Mon, 13 Sep 2021 17:31:11 +0000 (17:31 +0000)]
Auto merge of #9906 - camelid:fix-warnings, r=alexcrichton

Fix warnings from better precision of `dead_code` lint

The lint now ignores derived `Clone` and `Debug` implementations, as of
PR rust-lang/rust#85200, which landed a couple of days ago.

I sprinkled `#[allow(dead_code)]` in a few places; the fields are not
expected to be read since they are just part of a very specific test.

2 years agoFix warnings from better precision of `dead_code` lint
Noah Lev [Mon, 13 Sep 2021 17:21:06 +0000 (10:21 -0700)]
Fix warnings from better precision of `dead_code` lint

The lint now ignores derived `Clone` and `Debug` implementations, as of
PR rust-lang/rust#85200, which landed a couple of days ago.

I sprinkled `#[allow(dead_code)]` in a few places; the fields are not
expected to be read since they are just part of a very specific test.

2 years agoImprove "wrong output" error.
Eric Huss [Sat, 11 Sep 2021 23:34:09 +0000 (16:34 -0700)]
Improve "wrong output" error.

2 years agoAdd some contributor docs for debugging testsuite tests.
Eric Huss [Sat, 11 Sep 2021 18:26:38 +0000 (11:26 -0700)]
Add some contributor docs for debugging testsuite tests.

2 years agoFix warnings when documenting with `--document-private-items`
Joshua Nelson [Sat, 11 Sep 2021 17:33:45 +0000 (12:33 -0500)]
Fix warnings when documenting with `--document-private-items`

- Use hyperlinks for URLs
- Fix broken intra-doc links

This doesn't fix the following warning, since I wasn't sure what change
was appropriate:
```
warning: public documentation for `rustc_process` links to private item `self::core::compiler::Context::primary_packages`
   --> src/cargo/core/compiler/compilation.rs:164:22
    |
164 |     /// flag), see [`crate::core::compiler::Context::primary_packages`].
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this item is private
    |
    = note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
    = note: this link resolves only because you passed `--document-private-items`, but will break without
```

To avoid noise, this doesn't add an `allow` either.

2 years agoAuto merge of #9900 - ehuss:version-bump, r=alexcrichton
bors [Fri, 10 Sep 2021 18:24:27 +0000 (18:24 +0000)]
Auto merge of #9900 - ehuss:version-bump, r=alexcrichton

Bump to 0.58.0, update changelog

2 years agoAuto merge of #9898 - ehuss:rustc-profile-dev, r=alexcrichton
bors [Fri, 10 Sep 2021 17:54:06 +0000 (17:54 +0000)]
Auto merge of #9898 - ehuss:rustc-profile-dev, r=alexcrichton

Fix rustc --profile=dev unstable check.

This fixes an oversight from #9685 where `cargo rustc --profile=dev` was accidentally changed to require `-Zunstable-options`.  1.54 and earlier supported that [here](https://github.com/rust-lang/cargo/blob/rust-1.54.0/src/bin/cargo/commands/rustc.rs#L490.

Fixes #9897

2 years agoUpdate changelog for 1.56
Eric Huss [Fri, 10 Sep 2021 17:26:37 +0000 (10:26 -0700)]
Update changelog for 1.56

2 years agoBump to 0.58.0
Eric Huss [Fri, 10 Sep 2021 16:47:06 +0000 (09:47 -0700)]
Bump to 0.58.0

2 years agoFix rustc --profile=dev unstable check.
Eric Huss [Fri, 10 Sep 2021 16:40:37 +0000 (09:40 -0700)]
Fix rustc --profile=dev unstable check.

2 years agoAuto merge of #9896 - frogtile:master, r=ehuss
bors [Fri, 10 Sep 2021 03:37:39 +0000 (03:37 +0000)]
Auto merge of #9896 - frogtile:master, r=ehuss

config.md: fix typo

match  value with comment

2 years agoconfig.md: fix typo
frogtile [Fri, 10 Sep 2021 03:21:34 +0000 (09:21 +0600)]
config.md: fix typo

match  value with comment

2 years agoAuto merge of #9893 - ehuss:windows-echo, r=alexcrichton
bors [Thu, 9 Sep 2021 15:33:04 +0000 (15:33 +0000)]
Auto merge of #9893 - ehuss:windows-echo, r=alexcrichton

Enable some tests on windows.

This enables some more tests on windows that were disabled because `echo` is not always available. It's pretty easy to make a custom `echo`, so that's what this does.  I'm generally not comfortable with disabling tests just because there is an inconvenience like this.

2 years agoAuto merge of #9889 - ehuss:macos-strip, r=alexcrichton
bors [Thu, 9 Sep 2021 15:03:39 +0000 (15:03 +0000)]
Auto merge of #9889 - ehuss:macos-strip, r=alexcrichton

Enable strip test on macos.

This enables the `strip_works` test for macos, which was fixed a while ago in https://github.com/rust-lang/rust/pull/82037.

2 years agoAuto merge of #9890 - ehuss:remove-z-force-warn, r=alexcrichton
bors [Thu, 9 Sep 2021 14:36:06 +0000 (14:36 +0000)]
Auto merge of #9890 - ehuss:remove-z-force-warn, r=alexcrichton

Fix `cargo fix --edition` on stable.

I accidentally missed the removal of a `-Zunstable-options` flag in #9800.  This prevented `cargo fix --edition` from working on stable/beta.

2 years agoEnable some tests on windows.
Eric Huss [Thu, 9 Sep 2021 05:53:05 +0000 (22:53 -0700)]
Enable some tests on windows.

2 years agoFix `cargo fix --edition` on stable.
Eric Huss [Thu, 9 Sep 2021 04:31:45 +0000 (21:31 -0700)]
Fix `cargo fix --edition` on stable.

2 years agoEnable strip test on macos.
Eric Huss [Thu, 9 Sep 2021 03:12:35 +0000 (20:12 -0700)]
Enable strip test on macos.

2 years agoAuto merge of #9873 - hi-rustin:rustin-patch-mask, r=alexcrichton
bors [Wed, 8 Sep 2021 14:32:15 +0000 (14:32 +0000)]
Auto merge of #9873 - hi-rustin:rustin-patch-mask, r=alexcrichton

Remove log output that may leak tokens

close https://github.com/rust-lang/cargo/issues/9822

2 years agoRemove log
二手掉包工程师 [Wed, 8 Sep 2021 12:51:24 +0000 (20:51 +0800)]
Remove log

2 years agoAuto merge of #9859 - dtolnay-contrib:pullrequest, r=ehuss
bors [Tue, 7 Sep 2021 17:51:57 +0000 (17:51 +0000)]
Auto merge of #9859 - dtolnay-contrib:pullrequest, r=ehuss

rev = "refs/pull/𑑛/head"

GitHub exposes a named reference associated with the head of every pull request. For example, you can fetch *this* pull request:

```console
$ git fetch origin refs/pull/9859/head
$ git show FETCH_HEAD
```

Usually when I care about pulling in a patch of one of my dependencies using `[patch.crates-io]`, this is the ref that I want to depend on. None of the alternatives are good:

- `{ git = "the fork", branch = "the-pr-branch" }` &mdash; this is second closest to what I want, except that when the PR merges and the PR author deletes their fork, it'll breaks.

- `{ git = "the fork", rev = "commithash" }` &mdash; same failure mode as the previous. Also doesn't stay up to date with PR, which is sometimes what I want.

- `{ git = "the upstream", rev = "commithash" }` &mdash; doesn't work until the PR is merged or the repo owner creates a named branch or tag containing the PR commit among its ancestors, because otherwise the commit doesn't participate in Cargo's fetch.

- `{ git = "my own fork of PR author's repo", branch = "the-pr-branch" }` &mdash; doesn't stay up to date with PR.

This PR adds support for specifying a git dependency on the head of a pull request via the existing `rev` setting of git dependencies: `{ git = "the upstream", rev = "refs/pull/9859/head" }`.

Previously this would fail because the `cargo::sources::git::fetch` function touched in this pull request did not fetch the refspec that we care about. The failures look like:

```console
error: failed to get `mockall` as a dependency of package `testing v0.0.0`

Caused by:
  failed to load source for dependency `mockall`

Caused by:
  Unable to update https://github.com/asomers/mockall?rev=refs/pull/330/head

Caused by:
  revspec 'refs/pull/330/head' not found; class=Reference (4); code=NotFound (-3)
```

If dual purposing `rev` for this is not appealing, I would alternatively propose `{ git = "the upstream", pull-request = "9859" }` which Cargo will interpret using GitHub's ref naming convention as `refs/pull/9859/head`.

2 years agoAuto merge of #9877 - dswij:fix-init-bin-help, r=ehuss
bors [Mon, 6 Sep 2021 14:45:41 +0000 (14:45 +0000)]
Auto merge of #9877 - dswij:fix-init-bin-help, r=ehuss

Update suggestion message on bad project name error

closes #9876

Error message suggest adding `[bin]` to `Cargo.toml` which should be `[[bin]]` instead.

2 years agoUpdate help message on bad project name creation `[bin]` -> `[[bin]]`
dswij [Mon, 6 Sep 2021 06:22:45 +0000 (14:22 +0800)]
Update help message on bad project name creation `[bin]` -> `[[bin]]`

2 years agoUpdate test output for hint on project creation `[bin]` -> `[[bin]]`
dswij [Mon, 6 Sep 2021 07:45:12 +0000 (15:45 +0800)]
Update test output for hint on project creation `[bin]` -> `[[bin]]`

2 years agoAuto merge of #9871 - davepacheco:issue-9868, r=ehuss
bors [Sat, 4 Sep 2021 18:13:44 +0000 (18:13 +0000)]
Auto merge of #9871 - davepacheco:issue-9868, r=ehuss

clarify what goes into "*-sys" crates

Fixes #9868

2 years agoMask token with "*"
hi-rustin [Sat, 4 Sep 2021 04:45:45 +0000 (12:45 +0800)]
Mask token with "*"

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoclarify what goes into "*-sys" crates
David Pacheco [Fri, 3 Sep 2021 17:56:09 +0000 (10:56 -0700)]
clarify what goes into "*-sys" crates

2 years agoAuto merge of #9869 - nipunn1313:errmsg, r=alexcrichton
bors [Fri, 3 Sep 2021 15:22:58 +0000 (15:22 +0000)]
Auto merge of #9869 - nipunn1313:errmsg, r=alexcrichton

Improve error message when unable to initialize git index repo

With this - it'll be more obvious which git repo
couldn't be initialized.

Looks like this
```
➜  cargo RUST_BACKTRACE=1 target/debug/cargo build
error: failed to get `anyhow` as a dependency of package `cargo v0.57.0 (/Users/nipunn/src/cargo)`

Caused by:
  failed to initialize index git repository (in "/Users/nipunn/.cargo/registry/index/github.com-1ecc6299db9ec823")

Caused by:
  failed to parse config file: invalid configuration key (in /Users/nipunn/.config/git/config:1); class=Config (7)
```

Does the best we can with #9854 - since I don't think it can actually be fixed.
Fixes #9854

2 years agoImprove error message when unable to initialize git index repo
Nipunn Koorapati [Fri, 3 Sep 2021 01:09:31 +0000 (21:09 -0400)]
Improve error message when unable to initialize git index repo

With this - it'll be more obvious which git repo
couldn't be initialized.

2 years agoAuto merge of #9865 - nipunn1313:pkg_in_repo, r=alexcrichton
bors [Thu, 2 Sep 2021 14:17:23 +0000 (14:17 +0000)]
Auto merge of #9865 - nipunn1313:pkg_in_repo, r=alexcrichton

Use serde_json to generate cargo_vcs_info.json

Should make it easier to add fields in the future

2 years agoUse serde_json to generate cargo_vcs_info.json
Nipunn Koorapati [Thu, 2 Sep 2021 04:48:24 +0000 (00:48 -0400)]
Use serde_json to generate cargo_vcs_info.json

Should make it easier to add fields in the future

2 years agoAuto merge of #9850 - hi-rustin:rustin-patch-no-track, r=alexcrichton
bors [Wed, 1 Sep 2021 14:26:00 +0000 (14:26 +0000)]
Auto merge of #9850 - hi-rustin:rustin-patch-no-track, r=alexcrichton

print the full destination path when no track duplicates

close https://github.com/rust-lang/cargo/issues/9797

2 years agoAuto merge of #9800 - ehuss:stabilize-2021, r=alexcrichton
bors [Wed, 1 Sep 2021 13:53:35 +0000 (13:53 +0000)]
Auto merge of #9800 - ehuss:stabilize-2021, r=alexcrichton

Stabilize 2021 edition

This stabilizes the 2021 edition.

Closes #9781

2 years agoDocument the use of `rev` to depend on pull requests
David Tolnay [Wed, 1 Sep 2021 07:41:23 +0000 (00:41 -0700)]
Document the use of `rev` to depend on pull requests

2 years agoAllow `rev = "refs/..."` to use the GitHub fast path
David Tolnay [Tue, 31 Aug 2021 18:11:32 +0000 (11:11 -0700)]
Allow `rev = "refs/..."` to use the GitHub fast path

2 years agoAdd test of git dependency on pull request
David Tolnay [Tue, 31 Aug 2021 01:48:02 +0000 (18:48 -0700)]
Add test of git dependency on pull request

2 years agoAllow dependency's rev to refer to a ref by name
David Tolnay [Tue, 31 Aug 2021 01:15:05 +0000 (18:15 -0700)]
Allow dependency's rev to refer to a ref by name

2 years agoTemporarily move test lockfile_constant_during_new to nightly.
Eric Huss [Wed, 1 Sep 2021 05:44:34 +0000 (22:44 -0700)]
Temporarily move test lockfile_constant_during_new to nightly.

2 years agoMake --force-warn support auto-detect.
Eric Huss [Tue, 17 Aug 2021 18:09:08 +0000 (11:09 -0700)]
Make --force-warn support auto-detect.