]> git.proxmox.com Git - cargo.git/log
cargo.git
3 years agoDon't use RUSTC_BOOTSTRAP for nightly-only tests
Jon Gjengset [Thu, 1 Apr 2021 17:39:05 +0000 (10:39 -0700)]
Don't use RUSTC_BOOTSTRAP for nightly-only tests

3 years agoMerge remote-tracking branch 'upstream/master' into z-allowed-features
Jon Gjengset [Wed, 31 Mar 2021 22:00:28 +0000 (15:00 -0700)]
Merge remote-tracking branch 'upstream/master' into z-allowed-features

3 years agoAuto merge of #9316 - ehuss:fix-semver-1.51, r=alexcrichton
bors [Wed, 31 Mar 2021 21:21:15 +0000 (21:21 +0000)]
Auto merge of #9316 - ehuss:fix-semver-1.51, r=alexcrichton

Fix semver docs for 1.51.

1.51 slightly changed the text of a few error messages. This should get CI passing again.

3 years agoFix semver docs for 1.51.
Eric Huss [Wed, 31 Mar 2021 20:55:52 +0000 (13:55 -0700)]
Fix semver docs for 1.51.

3 years agoFix after merge
Jon Gjengset [Wed, 31 Mar 2021 19:43:59 +0000 (12:43 -0700)]
Fix after merge

3 years agoMerge remote-tracking branch 'upstream/master' into z-allowed-features
Jon Gjengset [Wed, 31 Mar 2021 19:41:34 +0000 (12:41 -0700)]
Merge remote-tracking branch 'upstream/master' into z-allowed-features

3 years agoFuture-proof tests
Jon Gjengset [Wed, 31 Mar 2021 19:39:19 +0000 (12:39 -0700)]
Future-proof tests

3 years agoPrint features without Debug
Jon Gjengset [Wed, 31 Mar 2021 19:39:09 +0000 (12:39 -0700)]
Print features without Debug

3 years agoHandle allow-features in add()
Jon Gjengset [Wed, 31 Mar 2021 19:38:36 +0000 (12:38 -0700)]
Handle allow-features in add()

3 years agoSort feature list
Jon Gjengset [Wed, 31 Mar 2021 19:38:07 +0000 (12:38 -0700)]
Sort feature list

3 years agoMove from match guard to if
Jon Gjengset [Wed, 31 Mar 2021 19:37:51 +0000 (12:37 -0700)]
Move from match guard to if

3 years agoInclude allowed features in fingerprint
Jon Gjengset [Wed, 31 Mar 2021 19:35:23 +0000 (12:35 -0700)]
Include allowed features in fingerprint

If this weren't the case, a user that compiled, and then re-ran cargo
with a particular set of allowed features would not see any breakage
even if other unstable features were used.

The downside of this is that changing allow-features causes a full
re-compile, but that still _seems_ like the right thing to do.

3 years agoForward -Zallow-features inside mod compiler
Jon Gjengset [Wed, 31 Mar 2021 19:34:03 +0000 (12:34 -0700)]
Forward -Zallow-features inside mod compiler

3 years agoutil: Add iterator join method
Jon Gjengset [Wed, 31 Mar 2021 19:33:24 +0000 (12:33 -0700)]
util: Add iterator join method

3 years agoAuto merge of #9302 - ehuss:cargo-config, r=alexcrichton
bors [Tue, 30 Mar 2021 19:07:19 +0000 (19:07 +0000)]
Auto merge of #9302 - ehuss:cargo-config, r=alexcrichton

Add `cargo config` subcommand.

This adds an initial version of the `cargo config` command as discussed in #2362.

Closes #2362

3 years agoPrint environment note for json format, too.
Eric Huss [Mon, 29 Mar 2021 21:00:31 +0000 (14:00 -0700)]
Print environment note for json format, too.

3 years agoAuto merge of #9313 - matklad:feat-doc, r=ehuss
bors [Mon, 29 Mar 2021 21:01:52 +0000 (21:01 +0000)]
Auto merge of #9313 - matklad:feat-doc, r=ehuss

Give one more example for the --featuers CLI

The previous example confused me because I thought that `foo-feat` is
the syntax for `foo/feat`. The "explicit" example should clarify that.

closes #9305

3 years agoGive one more example for the --featuers CLI
Aleksey Kladov [Mon, 29 Mar 2021 20:00:40 +0000 (23:00 +0300)]
Give one more example for the --featuers CLI

The previous example confused me because I thought that `foo-feat` is
the syntax for `foo/feat`. The "explicit" example should clarify that.

closes #9305

3 years agoRemove duplicate code.
Eric Huss [Mon, 29 Mar 2021 17:43:37 +0000 (10:43 -0700)]
Remove duplicate code.

3 years agoAuto merge of #9308 - ehuss:version-bump, r=alexcrichton
bors [Mon, 29 Mar 2021 14:05:14 +0000 (14:05 +0000)]
Auto merge of #9308 - ehuss:version-bump, r=alexcrichton

Bump to 0.54.0, update changelog

3 years agoAuto merge of #9309 - sciguy16:out_dir_issue_url, r=ehuss
bors [Sun, 28 Mar 2021 20:38:53 +0000 (20:38 +0000)]
Auto merge of #9309 - sciguy16:out_dir_issue_url, r=ehuss

Make the URL to the tracking issue for `--out-dir` into a link

3 years agoMake the URL to the tracking issue for `--out-dir` into a link
David Young [Sat, 27 Mar 2021 20:36:04 +0000 (20:36 +0000)]
Make the URL to the tracking issue for `--out-dir` into a link

3 years agoUpdate changelog for 1.52
Eric Huss [Fri, 26 Mar 2021 20:36:14 +0000 (13:36 -0700)]
Update changelog for 1.52

3 years agoBump to 0.54.0
Eric Huss [Fri, 26 Mar 2021 19:28:47 +0000 (12:28 -0700)]
Bump to 0.54.0

3 years agoAuto merge of #9307 - ijackson:exit-code-string, r=joshtriplett
bors [Fri, 26 Mar 2021 16:59:39 +0000 (16:59 +0000)]
Auto merge of #9307 - ijackson:exit-code-string, r=joshtriplett

tests: Tolerate "exit status" in error messages

"exit code" is wrong terminology on Unix.  I am trying to fix this in Rust stdlib in https://github.com/rust-lang/rust/pull/83462 but this currently breaks the cargo test suite.

See that MR for full explanation of the change.

3 years agotests: Tolerate "exit status" in error messages
Ian Jackson [Fri, 26 Mar 2021 16:18:37 +0000 (16:18 +0000)]
tests: Tolerate "exit status" in error messages

"exit code" is wrong terminology on Unix.  I am trying to fix this in
Rust stdlib in
    https://github.com/rust-lang/rust/pull/83462
but this currently breaks the cargo test suite.

See that MR for full explanation of the change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAuto merge of #9298 - alexcrichton:mac-split-debuginfo-default, r=ehuss
bors [Fri, 26 Mar 2021 14:38:38 +0000 (14:38 +0000)]
Auto merge of #9298 - alexcrichton:mac-split-debuginfo-default, r=ehuss

Default macOS targets to `unpacked` debuginfo

This commit continues the work from #9112 to enable `unpacked` split
debuginfo on macOS targets by default. This has been discussed on [internals]
for awhile now and no breakage has emerged while significant speedups
have. This is expected to be a compile-time and `target`-directory size
win for almost all macOS Rust projects.

While breakage is possible it's possible to mitigate this with
project-local or global cargo configuration of the `dev` and `test` profiles.

[internals]: https://internals.rust-lang.org/t/help-test-faster-incremental-debug-macos-builds-on-nightly/14016/9

3 years agoDefault macOS targets to `unpacked` debuginfo
Alex Crichton [Wed, 24 Mar 2021 21:04:56 +0000 (14:04 -0700)]
Default macOS targets to `unpacked` debuginfo

This commit continues the work from #9112 to enable `unpacked` split
debuginfo on macOS targets by default. This has been discussed on [internals]
for awhile now and no breakage has emerged while significant speedups
have. This is expected to be a compile-time and `target`-directory size
win for almost all macOS Rust projects.

While breakage is possible it's possible to mitigate this with
project-local or global cargo configuration of the `dev` and `test` profiles.

[internals]: https://internals.rust-lang.org/t/help-test-faster-incremental-debug-macos-builds-on-nightly/14016/9

3 years agoAdd `cargo config` subcommand.
Eric Huss [Thu, 25 Mar 2021 19:56:24 +0000 (12:56 -0700)]
Add `cargo config` subcommand.

3 years agoAuto merge of #9300 - alexcrichton:fix-publish-metadata, r=ehuss
bors [Thu, 25 Mar 2021 20:07:04 +0000 (20:07 +0000)]
Auto merge of #9300 - alexcrichton:fix-publish-metadata, r=ehuss

Fix publication of packages with metadata and resolver

This commit fixes an issue where packages which specify `resolver = '2'`
cannot be packaged if they also have a `package.metadata` table. The
issue is that the `toml` serialization implementation serializes fields
in order which requires that tables be emitted last.

3 years agoMove script to bottom of page.
Eric Huss [Thu, 25 Mar 2021 18:47:52 +0000 (11:47 -0700)]
Move script to bottom of page.

3 years agoFix publication of packages with metadata and resolver
Alex Crichton [Thu, 25 Mar 2021 16:13:40 +0000 (09:13 -0700)]
Fix publication of packages with metadata and resolver

This commit fixes an issue where packages which specify `resolver = '2'`
cannot be packaged if they also have a `package.metadata` table. The
issue is that the `toml` serialization implementation serializes fields
in order which requires that tables be emitted last.

3 years agoAuto merge of #9299 - ehuss:fix-config-include, r=alexcrichton
bors [Thu, 25 Mar 2021 14:06:51 +0000 (14:06 +0000)]
Auto merge of #9299 - ehuss:fix-config-include, r=alexcrichton

Fix config includes not working.

The config-include feature wasn't working because the config values were being loaded before the call to `configure`, so the unstable flag was always false.

I had to remove the unstable warning because it was a bit awkward to support, and I figure it's not that important.

3 years agoFix config includes not working.
Eric Huss [Thu, 25 Mar 2021 03:21:09 +0000 (20:21 -0700)]
Fix config includes not working.

3 years agoForward -Zallow-features to rustc
Jon Gjengset [Wed, 24 Mar 2021 17:14:53 +0000 (10:14 -0700)]
Forward -Zallow-features to rustc

3 years agoTest that allowed-features in config works
Jon Gjengset [Wed, 24 Mar 2021 16:42:36 +0000 (09:42 -0700)]
Test that allowed-features in config works

3 years agoAuto merge of #9263 - Aaron1011:zero-incompat-note, r=ehuss
bors [Mon, 22 Mar 2021 22:59:56 +0000 (22:59 +0000)]
Auto merge of #9263 - Aaron1011:zero-incompat-note, r=ehuss

Emit note when `--future-incompat-report` had nothing to report

3 years agoAuto merge of #9282 - lf-:remove-author, r=ehuss
bors [Mon, 22 Mar 2021 21:04:12 +0000 (21:04 +0000)]
Auto merge of #9282 - lf-:remove-author, r=ehuss

RFC 3052: Stop including authors field in manifests made by cargo new

See https://github.com/rust-lang/rust/issues/83227

~~This is definitely a draft as there are a couple of tests I'm still working on fixing.~~ One question I ran into while digging through these test failures is that there is a Cargo config option for author name, `cargo-new.name`. Should we keep supporting that? I feel like perhaps we should as the user has specified explicit intent that they want their name in the authors of a manifest as generated by `cargo new`, but it seems weird to support *just* that case. There is likewise an environment variable `CARGO_NAME` that signals similar intent.

Should we completely drop the feature of putting in author names, and require people to manually put them in if they wish, or allow these limited cases where the user is specifically instructing *cargo* to do it?

3 years agoTest the generated manifest does not contain authors =
Jade [Sat, 20 Mar 2021 10:44:25 +0000 (03:44 -0700)]
Test the generated manifest does not contain authors =

3 years agoDelete uses of the USER env var from tests
Jade [Sat, 20 Mar 2021 09:45:01 +0000 (02:45 -0700)]
Delete uses of the USER env var from tests

3 years agoRemove every unnecessary appearance of the authors field in docs
Jade [Sat, 20 Mar 2021 09:35:51 +0000 (02:35 -0700)]
Remove every unnecessary appearance of the authors field in docs

3 years agoRestore the tests that could be reused
Jade [Sat, 20 Mar 2021 08:45:19 +0000 (01:45 -0700)]
Restore the tests that could be reused

3 years agoFinish documentation changes
Jade [Fri, 19 Mar 2021 07:18:21 +0000 (00:18 -0700)]
Finish documentation changes

3 years agoUpdate docs for default absent authors field
lf- [Thu, 18 Mar 2021 07:47:05 +0000 (00:47 -0700)]
Update docs for default absent authors field

3 years agoDelete redundant broken tests
lf- [Thu, 18 Mar 2021 07:24:12 +0000 (00:24 -0700)]
Delete redundant broken tests

3 years agoRFC 3052: Stop including authors field in manifests made by cargo new
Jade [Wed, 17 Mar 2021 18:56:34 +0000 (11:56 -0700)]
RFC 3052: Stop including authors field in manifests made by cargo new

See https://github.com/rust-lang/rust/issues/83227

3 years agoAuto merge of #9290 - ehuss:non-member-features, r=alexcrichton
bors [Mon, 22 Mar 2021 14:40:21 +0000 (14:40 +0000)]
Auto merge of #9290 - ehuss:non-member-features, r=alexcrichton

Refactor feature handling, and improve error messages.

This changes the way feature strings are handled with an eye towards fixing some improper handling and to improve error messages. The key change is to stop treating all features as free-form strings and instead try to handle them as typed values. This helps avoid needing to deal with parsing different feature syntax (like `dep:` or `foo/bar`) or forgetting to handle it properly.

Overview of refactoring changes:

* `RequestedFeatures` changed to an enum to differentiate between features coming from the command-line, and those that are from a dependency.
* Moved parsing of CLI features to an earlier stage (now stored in `CompileOptions`), and ensures that they are properly handled as `FeatureValue` instead of strings.
* Pushed some feature validation earlier. For example, `DetailedTomlDependency` now validates things so you can see the location for the errant `Cargo.toml` (previously some validation was deep in the resolver, which provided poor errors).

This is a pretty large PR, but at the core it is just changing `RequestedFeatures` and then dealing with the fallout from that. Hopefully this is an improvement overall.

List of user-visible changes:

* Fix handling in resolver V2 of `--features bar?/feat` and `--features dep:bar`
* Better error handling for `bar/feat` and `dep:bar` in dependency declarations.
* Feature keys in the `[features]` table can no longer contain slashes.
* Fixed a minor issue with `cargo tree -e features --all-features -Z namespaced-features`
* Fixed a panic with `cargo tree` involving `-Z weak-dep-features`

I did a small amount of benchmarking, and I wasn't able to record much of a difference.

3 years agoAuto merge of #9292 - ehuss:cargo-util, r=alexcrichton
bors [Mon, 22 Mar 2021 14:11:51 +0000 (14:11 +0000)]
Auto merge of #9292 - ehuss:cargo-util, r=alexcrichton

Split out cargo-util package for cargo-test-support.

This splits out code from `cargo` that was being used by `cargo-test-support` in order to remove the dev-dependency cycle on the `cargo` crate. The intent here is to improve development build times. On my system, `touch src/cargo/lib.rs ; cargo check --profile=test` goes from 6.4 seconds to 3.5. I suspect more substantial changes (more than just `touch`) should exhibit even more improvements.

This has a substantial downside that it is another package to manage publishing, particularly with making sure the version is updated correctly for crates.io. I'm uncertain if on balance it is worth it, but I lean towards moving forward with it.

3 years agoAuto merge of #9293 - ehuss:unnecessary-semi-resolver-tests, r=alexcrichton
bors [Mon, 22 Mar 2021 00:10:05 +0000 (00:10 +0000)]
Auto merge of #9293 - ehuss:unnecessary-semi-resolver-tests, r=alexcrichton

Fix redundant_semicolons warning in resolver-tests.

3 years agoFix redundant_semicolons warning in resolver-tests.
Eric Huss [Sun, 21 Mar 2021 00:44:08 +0000 (17:44 -0700)]
Fix redundant_semicolons warning in resolver-tests.

3 years agoRemove the dev-dependency cycle on cargo.
Eric Huss [Sat, 20 Mar 2021 21:40:01 +0000 (14:40 -0700)]
Remove the dev-dependency cycle on cargo.

3 years agoRemove cargo:: link.
Eric Huss [Sat, 20 Mar 2021 21:38:34 +0000 (14:38 -0700)]
Remove cargo:: link.

3 years agoRemove use of CRATES_IO_INDEX in cargo-test-support.
Eric Huss [Sat, 20 Mar 2021 21:37:46 +0000 (14:37 -0700)]
Remove use of CRATES_IO_INDEX in cargo-test-support.

Unfortunate duplication of the string, but I think it is unlikely
to have any consequences.

3 years agoRemove CargoResult from cargo-test-support.
Eric Huss [Sat, 20 Mar 2021 21:35:48 +0000 (14:35 -0700)]
Remove CargoResult from cargo-test-support.

3 years agoRemove use of Rustc from cargo-test-support.
Eric Huss [Sat, 20 Mar 2021 21:31:09 +0000 (14:31 -0700)]
Remove use of Rustc from cargo-test-support.

cargo-test-support wasn't using any of the caching or other logic from
Rustc, so this just swaps with a very basic implementation in order to
remove the dependency on `cargo`.

3 years agoMove Sha256 to cargo-util.
Eric Huss [Sat, 20 Mar 2021 20:56:56 +0000 (13:56 -0700)]
Move Sha256 to cargo-util.

3 years agoMove `paths` to cargo-util.
Eric Huss [Sat, 20 Mar 2021 20:43:33 +0000 (13:43 -0700)]
Move `paths` to cargo-util.

3 years agoMove is_ci to cargo-util.
Eric Huss [Sat, 20 Mar 2021 19:04:25 +0000 (12:04 -0700)]
Move is_ci to cargo-util.

3 years agoMove ProcessBuilder to cargo-util.
Eric Huss [Sat, 20 Mar 2021 18:28:38 +0000 (11:28 -0700)]
Move ProcessBuilder to cargo-util.

3 years agoSplit util code into a separate package.
Eric Huss [Sat, 20 Mar 2021 04:15:26 +0000 (21:15 -0700)]
Split util code into a separate package.

3 years agoAuto merge of #9237 - yaymukund:serde-expecting, r=ehuss
bors [Sat, 20 Mar 2021 02:36:40 +0000 (02:36 +0000)]
Auto merge of #9237 - yaymukund:serde-expecting, r=ehuss

Use serde's error message option to avoid implementing `Deserialize`.

This is a cleanup based on https://github.com/serde-rs/serde/issues/1883, which fell out of https://github.com/rust-lang/cargo/pull/8664

It looks like this changes the resulting error messages. I'll leave it up to you to decide if the tradeoff makes sense here. Maybe the correct answer here is to make `serde`'s error messages include more details (e.g. `invalid type: int`).

3 years agoUse serde's error message option to avoid implementing `Deserialize`.
Mukund Lakshman [Fri, 19 Mar 2021 23:22:39 +0000 (23:22 +0000)]
Use serde's error message option to avoid implementing `Deserialize`.

3 years agoRefactor feature handling, and improve error messages.
Eric Huss [Fri, 19 Mar 2021 21:36:26 +0000 (14:36 -0700)]
Refactor feature handling, and improve error messages.

3 years agoImport anyhow::bail
Eric Huss [Wed, 17 Mar 2021 22:13:48 +0000 (15:13 -0700)]
Import anyhow::bail

3 years agoAuto merge of #9279 - Revantus:offline_precise, r=alexcrichton
bors [Thu, 18 Mar 2021 18:23:28 +0000 (18:23 +0000)]
Auto merge of #9279 - Revantus:offline_precise, r=alexcrichton

Allow `cargo update` to operate with the --offline flag

Closes #9248

Limiting to `--precise` operations as the package should be cached locally prior to the usage of offline.

Added an additional test to [offline.rs](tests/testsuite/offline.rs).

3 years agoFix offline tests. Rename to cached/not_cached.
Revantus [Thu, 18 Mar 2021 14:33:55 +0000 (08:33 -0600)]
Fix offline tests. Rename to cached/not_cached.

3 years agoRemove eager fail for update --offline
Revantus [Thu, 18 Mar 2021 14:04:42 +0000 (08:04 -0600)]
Remove eager fail for update --offline

3 years agoAuto merge of #9285 - rusty-snake:patch-1, r=ehuss
bors [Thu, 18 Mar 2021 14:01:08 +0000 (14:01 +0000)]
Auto merge of #9285 - rusty-snake:patch-1, r=ehuss

Fix typo in faq.md

3 years agoFix typo in faq.md
rusty-snake [Thu, 18 Mar 2021 12:32:42 +0000 (12:32 +0000)]
Fix typo in faq.md

3 years agoAdd -Zallow-features to match rustc's -Z
Jon Gjengset [Wed, 17 Mar 2021 22:19:54 +0000 (15:19 -0700)]
Add -Zallow-features to match rustc's -Z

3 years agoAuto merge of #9268 - ehuss:2021-fix-edition-v2-warning, r=alexcrichton
bors [Tue, 16 Mar 2021 21:36:55 +0000 (21:36 +0000)]
Auto merge of #9268 - ehuss:2021-fix-edition-v2-warning, r=alexcrichton

Add report if `cargo fix --edition` changes features.

This adds a small report if using `cargo fix --edition` to transition from 2018 to 2021 to determine if the new resolver will result in different features.

There is a gauntlet of checks that must pass before it even tries to show the differences:
* If the resolver is already specified, skip.
* If in a virtual workspace, skip (no way to specify global edition).
* If not migrating the root package, skip. The edition only changes the resolver in the root package.
* If not migrating all targets, skip. It's uncertain if the user intends to set the package edition or not.

Closes #9048

3 years agoAuto merge of #9275 - ehuss:features-non-member, r=alexcrichton
bors [Tue, 16 Mar 2021 20:55:20 +0000 (20:55 +0000)]
Auto merge of #9275 - ehuss:features-non-member, r=alexcrichton

Fix --feature pkg/feat for V1 resolver for non-member.

#8997 had an unintended regression where `-p foo --feature foo/feat` syntax where `foo` is an **optional non-member** fails with an error that `foo` did not match any packages.  The issue is that the member/feature selection routine needed to slot this into the features for the package in the current working directory (it was incorrectly treating `foo` as a workspace member).

V2 outright does not allow specifying features for non-workspace members.

Fixes #9265

3 years agoRemove --all-targets restriction for v2 resolver migration check.
Eric Huss [Tue, 16 Mar 2021 18:42:01 +0000 (11:42 -0700)]
Remove --all-targets restriction for v2 resolver migration check.

3 years agoAdd report if `cargo fix --edition` changes features.
Eric Huss [Sun, 14 Mar 2021 22:01:31 +0000 (15:01 -0700)]
Add report if `cargo fix --edition` changes features.

3 years agoAuto merge of #9276 - ehuss:fix-collision-root-removal, r=alexcrichton
bors [Tue, 16 Mar 2021 18:23:15 +0000 (18:23 +0000)]
Auto merge of #9276 - ehuss:fix-collision-root-removal, r=alexcrichton

Fix doc duplicate removal of root units.

The doc collision removal code didn't consider the possibility that there was a collision with a root unit.  This caused problems in conjunction with #9142 where cargo would panic because a root unit got removed from the graph because of a filename collision. The solution here is to avoid removing root units during the doc collision sweep.

This has a downside that this reintroduces a filename collision.

An alternate solution would be to make the set of root units mutable, and remove from that list, but I figured this is simpler and more conservative.

Fixes #9274

3 years agoFix doc duplicate removal of root units.
Eric Huss [Tue, 16 Mar 2021 17:32:08 +0000 (10:32 -0700)]
Fix doc duplicate removal of root units.

3 years agoAuto merge of #9271 - jonhoo:patch-in-config-in-help, r=ehuss
bors [Mon, 15 Mar 2021 23:36:20 +0000 (23:36 +0000)]
Auto merge of #9271 - jonhoo:patch-in-config-in-help, r=ehuss

Add CLI help text for patch-in-config

Tracking issue: #9269

3 years agoAdd CLI help text for patch-in-config
Jon Gjengset [Mon, 15 Mar 2021 23:23:29 +0000 (16:23 -0700)]
Add CLI help text for patch-in-config

3 years agoAuto merge of #9270 - jonhoo:document-patch-in-config, r=ehuss
bors [Mon, 15 Mar 2021 23:06:17 +0000 (23:06 +0000)]
Auto merge of #9270 - jonhoo:document-patch-in-config, r=ehuss

Document `-Zpatch-in-config`

Tracking issue: https://github.com/rust-lang/cargo/issues/9269

3 years agoLink tracking issue
Jon Gjengset [Mon, 15 Mar 2021 20:55:29 +0000 (13:55 -0700)]
Link tracking issue

3 years agoUse feature name as heading
Jon Gjengset [Mon, 15 Mar 2021 20:53:28 +0000 (13:53 -0700)]
Use feature name as heading

3 years agoDocument the patch-in-config feature
Jon Gjengset [Mon, 15 Mar 2021 20:51:33 +0000 (13:51 -0700)]
Document the patch-in-config feature

3 years agoAuto merge of #9204 - jonhoo:patch-in-config, r=alexcrichton
bors [Mon, 15 Mar 2021 16:58:26 +0000 (16:58 +0000)]
Auto merge of #9204 - jonhoo:patch-in-config, r=alexcrichton

Support [patch] in .cargo/config files

This patch adds support for `[patch]` sections in `.cargo/config.toml`
files. Patches from config files defer to `[patch]` in `Cargo.toml` if
both provide a patch for the same crate.

The current implementation merge config patches into the workspace
manifest patches. It's unclear if that's the right long-term plan, or
whether these patches should be stored separately (though likely still
in the manifest). Regardless, they _should_ likely continue to be
parsed when the manifest is parsed so that errors and such occur in the
same place regardless of where a patch is specified.

Fixes #5539.

3 years agoFixes from review
Jon Gjengset [Mon, 15 Mar 2021 16:54:48 +0000 (09:54 -0700)]
Fixes from review

3 years agoAuto merge of #9264 - Aaron1011:future-incompat-report-test-cmd, r=alexcrichton
bors [Mon, 15 Mar 2021 14:31:12 +0000 (14:31 +0000)]
Auto merge of #9264 - Aaron1011:future-incompat-report-test-cmd, r=alexcrichton

Add `--future-incompat-report` support to `cargo test`

This was missed in the original PR

3 years agoEmit note when `--future-incompat-report` had nothing to report
Aaron Hill [Sun, 14 Mar 2021 19:45:54 +0000 (15:45 -0400)]
Emit note when `--future-incompat-report` had nothing to report

3 years agoFix --feature pkg/feat for V1 resolver for non-member.
Eric Huss [Mon, 15 Mar 2021 02:05:12 +0000 (19:05 -0700)]
Fix --feature pkg/feat for V1 resolver for non-member.

3 years agoAuto merge of #9262 - Matt-Gleich:master, r=Eh2406
bors [Sun, 14 Mar 2021 23:15:17 +0000 (23:15 +0000)]
Auto merge of #9262 - Matt-Gleich:master, r=Eh2406

🍱 Crop favicon

Hello! At first glance I found doc.rust-lang.org/cargo's favicon to be a bit small compared to other site's favicons. Looked into it and found that the logo hasn't been cropped. All I did was crop the favicon in this PR. As you can see from the image below (new favicon on the right) it looks much better:

![Screen Shot 2021-03-14 at 1 24 38 PM](https://user-images.githubusercontent.com/43759105/111077749-a1ee3280-84c8-11eb-948d-6101ec1a6f77.jpg)

This has been done to crates.io's favicon as well in rust-lang/crates.io#3411. Thanks, you maintainers! :)

3 years agoAdd `--future-incompat-report` support to `cargo test`
Aaron Hill [Sun, 14 Mar 2021 19:50:01 +0000 (15:50 -0400)]
Add `--future-incompat-report` support to `cargo test`

This was missed in the original PR

3 years ago🍱 Crop favicon
Matthew Gleich [Sun, 14 Mar 2021 17:05:28 +0000 (13:05 -0400)]
🍱 Crop favicon

Signed-off-by: Matthew Gleich <git@mattglei.ch>
3 years agoSwitching precise check from match to `is_none()`
Revantus [Sun, 14 Mar 2021 13:23:52 +0000 (07:23 -0600)]
Switching precise check from match to `is_none()`

3 years agoAllowing update --offline with precise flags
Revantus [Sun, 14 Mar 2021 12:36:36 +0000 (06:36 -0600)]
Allowing update --offline with precise flags

Adding additional test for updating against changed offline
dependancies.

rust-lang/cargo#9248

3 years agoAuto merge of #9252 - ehuss:prefer-dynamic-ws, r=alexcrichton
bors [Sat, 13 Mar 2021 01:18:40 +0000 (01:18 +0000)]
Auto merge of #9252 - ehuss:prefer-dynamic-ws, r=alexcrichton

Fix logic for determining prefer-dynamic for a dylib.

The logic for determining if a dylib should use `prefer-dynamic` used to be something like "do not use prefer-dynamic if it is the current package".

The current logic has a strange behavior where it works as intended if there is only one package in the workspace, but a workspace with multiple packages will always use `prefer-dynamic`.

Instead of using `current_opt`, which isn't a good concept to use in a workspace, I switched this to be "primary" (a package selected on the command-line).

**History**
9879a0a5f621a4ae44b2d9dc62a0175404c05f8f Initial prefer-dynamic behavior.
* #3221 changed to the faulty logic (see comments at https://github.com/rust-lang/cargo/pull/3221#discussion_r88535221). I think there was some confusion there.
* #3478 fixed the logic for one of the changed conditions, but not the one for prefer-dynamic

3 years agoAuto merge of #9255 - ehuss:fix-deps-filtering, r=Eh2406
bors [Thu, 11 Mar 2021 19:57:49 +0000 (19:57 +0000)]
Auto merge of #9255 - ehuss:fix-deps-filtering, r=Eh2406

Fix issue with filtering exclusive target dependencies.

#8777 incorrectly changed the filtering logic for dependencies.  Essentially it split `filter(any(A && B && C && D))` into two parts `filter(any(A && B)).filter(any(C && D))` which doesn't have the same meaning. The solution here is to pass a closure so that the conditions are joined again.

Fixes #9216

3 years agoFix issue with filtering exclusive target dependencies.
Eric Huss [Thu, 11 Mar 2021 19:41:00 +0000 (11:41 -0800)]
Fix issue with filtering exclusive target dependencies.

3 years agoFix logic for determining prefer-dynamic for a dylib.
Eric Huss [Thu, 11 Mar 2021 05:33:48 +0000 (21:33 -0800)]
Fix logic for determining prefer-dynamic for a dylib.

3 years agoAuto merge of #9249 - ehuss:doc-pkgid-spec, r=alexcrichton
bors [Wed, 10 Mar 2021 15:22:00 +0000 (15:22 +0000)]
Auto merge of #9249 - ehuss:doc-pkgid-spec, r=alexcrichton

Update pkgid-spec docs.

The old docs for the pkgid spec weren't correct. Specs never supported abbreviated URLs or aliases for the index (like `crates.io`).  This tries to correct that and add a little more detail.

Part of #7725.

3 years agoUpdate pkgid-spec docs.
Eric Huss [Wed, 10 Mar 2021 00:26:34 +0000 (16:26 -0800)]
Update pkgid-spec docs.

3 years agoAuto merge of #9233 - alexcrichton:reword-edition, r=ehuss
bors [Tue, 9 Mar 2021 22:46:30 +0000 (22:46 +0000)]
Auto merge of #9233 - alexcrichton:reword-edition, r=ehuss

Wordsmith the edition documentation a bit more

This hopes to clear up a few recent PRs about the `edition` key in the
manifest. It shuffles things around so the defaults are talked about in
two different paragraphs. The first one talks about how `cargo new` uses
the 2018 edition and is the only paragraph to use the word "default".
The second section talks about the usage of 2015 with no `edition` field
present.

This didn't end up being quite as clear as I hoped it might be, but I'm
hoping that this provides a bit more emphasis or otherwise just
restructures things a bit to be more clear.

3 years agoAuto merge of #9188 - weihanglo:issue-9041, r=ehuss
bors [Tue, 9 Mar 2021 18:47:47 +0000 (18:47 +0000)]
Auto merge of #9188 - weihanglo:issue-9041, r=ehuss

Package ID specification urls must contain a host

Resolves https://github.com/rust-lang/cargo/issues/9041

Not sure which commit breaks this. Cargo shipped with rust 1.46 didn't unwrap on a `None` but 1.47 did. Even checkouted to 149022b1d8f382e69c1616f6a46b69ebf59e2dea (cargo of rust 1.46), it still unwrap unexpectedly.

So I ended up following the [Specification grammer](https://doc.rust-lang.org/cargo/reference/pkgid-spec.html#specification-grammar) to make sure there is a `host` in the pkgid urls.

<details>
<summary>See console output</summary>

cargo of rust 1.46
```console
$ cargo +1.46 -vV
cargo 1.46.0 (149022b1d 2020-07-17)
release: 1.46.0
commit-hash: 149022b1d8f382e69c1616f6a46b69ebf59e2dea
commit-date: 2020-07-17

$ cargo +1.46 pkgid /path
error: package ID specification `/path` matched no packages
```

cargo of rust 1.47

```console
$ cargo +1.47 -vV
cargo 1.47.0 (f3c7e066a 2020-08-28)
release: 1.47.0
commit-hash: f3c7e066ad66e05439cf8eab165a2de580b41aaf
commit-date: 2020-08-28

$ cargo +1.47 pkgid /path
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/tools/cargo/src/cargo/core/package_id_spec.rs:234:50
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

cargo on commit 149022b1d8f382e69c1616f6a46b69ebf59e2dea

```console
$ git checkout 149022b1d8f382e69c1616f6a46b69ebf59e2dea
$ cargo run -- pkgid /path
   Compiling cargo-platform v0.1.1 ([..]/cargo/crates/cargo-platform)
   Compiling crates-io v0.31.1 ([..]/cargo/crates/crates-io)
   Compiling cargo v0.47.0 ([..]/cargo)
    Finished dev [unoptimized + debuginfo] target(s) in 22.90s
     Running `target/debug/cargo pkgid /path`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/cargo/core/package_id_spec.rs:234:50
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
</details>