Commit graph

10845 commits

Author SHA1 Message Date
Eric Huss
1130bc076f Fix config includes not working. 2021-03-24 20:21:09 -07:00
Jon Gjengset
85f7c800f8 Forward -Zallow-features to rustc 2021-03-24 10:14:53 -07:00
Jon Gjengset
caca4d43a0 Test that allowed-features in config works 2021-03-24 09:42:36 -07:00
bors
58a9613144 Auto merge of #9263 - Aaron1011:zero-incompat-note, r=ehuss
Emit note when `--future-incompat-report` had nothing to report
2021-03-22 22:59:56 +00:00
bors
4751e5cc31 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?
2021-03-22 21:04:12 +00:00
Jade
160b7f1dac Test the generated manifest does not contain authors = 2021-03-22 13:39:18 -07:00
Jade
de45c6f97a Delete uses of the USER env var from tests 2021-03-22 13:39:18 -07:00
Jade
96f8dbf865 Remove every unnecessary appearance of the authors field in docs 2021-03-22 13:39:18 -07:00
Jade
b09988649a Restore the tests that could be reused 2021-03-22 13:39:18 -07:00
Jade
67abe0f983 Finish documentation changes 2021-03-22 13:39:18 -07:00
lf-
63717bfc19 Update docs for default absent authors field 2021-03-22 13:39:18 -07:00
lf-
47347de87e Delete redundant broken tests 2021-03-22 13:39:18 -07:00
Jade
c685eb322b RFC 3052: Stop including authors field in manifests made by cargo new
See https://github.com/rust-lang/rust/issues/83227
2021-03-22 13:39:15 -07:00
bors
39d9413ca2 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.
2021-03-22 14:40:21 +00:00
bors
fb45eb132e 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.
2021-03-22 14:11:51 +00:00
bors
99320bba7e Auto merge of #9293 - ehuss:unnecessary-semi-resolver-tests, r=alexcrichton
Fix redundant_semicolons warning in resolver-tests.
2021-03-22 00:10:05 +00:00
Eric Huss
378b086f2c Fix redundant_semicolons warning in resolver-tests. 2021-03-20 17:44:08 -07:00
Eric Huss
c840160a6d Remove the dev-dependency cycle on cargo. 2021-03-20 17:42:42 -07:00
Eric Huss
0fb35e3129 Remove cargo:: link. 2021-03-20 17:42:42 -07:00
Eric Huss
565591f6e9 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.
2021-03-20 17:42:41 -07:00
Eric Huss
0ad3fb1b57 Remove CargoResult from cargo-test-support. 2021-03-20 17:42:41 -07:00
Eric Huss
10224938bf 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`.
2021-03-20 17:42:41 -07:00
Eric Huss
4aa1ec2419 Move Sha256 to cargo-util. 2021-03-20 17:42:41 -07:00
Eric Huss
1dae5acb7d Move paths to cargo-util. 2021-03-20 17:42:41 -07:00
Eric Huss
dbfdd49559 Move is_ci to cargo-util. 2021-03-20 17:42:32 -07:00
Eric Huss
888100352a Move ProcessBuilder to cargo-util. 2021-03-20 15:19:03 -07:00
Eric Huss
669340333a Split util code into a separate package. 2021-03-20 15:15:54 -07:00
bors
610b07ffec 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`).
2021-03-20 02:36:40 +00:00
Mukund Lakshman
54742ce726 Use serde's error message option to avoid implementing Deserialize. 2021-03-19 23:22:39 +00:00
Eric Huss
85854b1884 Refactor feature handling, and improve error messages. 2021-03-19 14:59:53 -07:00
Eric Huss
cc70d60a9e Import anyhow::bail 2021-03-19 14:36:45 -07:00
bors
c9ce0ec40d 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).
2021-03-18 18:23:28 +00:00
Revantus
61a8f711df Fix offline tests. Rename to cached/not_cached. 2021-03-18 08:33:55 -06:00
Revantus
8ae547233f Remove eager fail for update --offline 2021-03-18 08:04:42 -06:00
bors
a908cc05fd Auto merge of #9285 - rusty-snake:patch-1, r=ehuss
Fix typo in faq.md
2021-03-18 14:01:08 +00:00
rusty-snake
f982eca55a
Fix typo in faq.md 2021-03-18 12:32:42 +00:00
Jon Gjengset
4a90ab6910 Add -Zallow-features to match rustc's -Z 2021-03-17 15:23:48 -07:00
bors
90691f2bfe 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
2021-03-16 21:36:55 +00:00
bors
841179ee60 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
2021-03-16 20:55:20 +00:00
Eric Huss
6c69e9d95b Remove --all-targets restriction for v2 resolver migration check. 2021-03-16 11:42:01 -07:00
Eric Huss
501499c5f9 Add report if cargo fix --edition changes features. 2021-03-16 11:39:21 -07:00
bors
8b08998f11 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
2021-03-16 18:23:15 +00:00
Eric Huss
e50292a153 Fix doc duplicate removal of root units. 2021-03-16 10:32:08 -07:00
bors
1e47626975 Auto merge of #9271 - jonhoo:patch-in-config-in-help, r=ehuss
Add CLI help text for patch-in-config

Tracking issue: #9269
2021-03-15 23:36:20 +00:00
Jon Gjengset
6d2728d91a Add CLI help text for patch-in-config 2021-03-15 16:23:29 -07:00
bors
434be949cd 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
2021-03-15 23:06:17 +00:00
Jon Gjengset
81116a9611 Link tracking issue 2021-03-15 13:55:29 -07:00
Jon Gjengset
795931118a Use feature name as heading 2021-03-15 13:53:28 -07:00
Jon Gjengset
622290e5f5 Document the patch-in-config feature 2021-03-15 13:51:33 -07:00
bors
695465c79a 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.
2021-03-15 16:58:26 +00:00