110 Commits

Author SHA1 Message Date
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Ed Page
08ed8de4d1 fix(resolver): Suggest similar looking features 2025-04-25 09:21:09 -05:00
Ed Page
f616aaf21a fix(resolver): Make features singular; we only track one 2025-04-24 20:47:03 -05:00
Ed Page
3fd3656479 fix(resolver): Have errors follow rustc's casing convention 2025-04-24 20:40:54 -05:00
Ed Page
93c734b395 fix(features): When feature activates a typo, suggest alt 2025-04-24 16:36:30 -05:00
Ed Page
a38d44c2b0 test(features): Show typoed feature behavior 2025-04-24 16:33:15 -05:00
Ed Page
a1c464457b test(features): Clarify test names 2025-04-24 16:23:54 -05:00
Ed Page
7be5a2146b fix: Remove implicit feature removal
Due to problems we ran into with #14016, we're removing implicit
features from the 2024 edition to give ourselves more time to design it
as we should.

I could have added a new flag for this or made an EditionNext but I
decided to remove it in the hopes to avoid any path dependency in
solving this the next time.
2024-10-01 11:48:31 -05:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Ed Page
407a32c11c Revert "fix: Ensure dep/feature activates the dependency on 2024"
Fixes #14283 by re-opening #14016 so we don't block people testing other
Edition 2024 changes.

This reverts commit 99fae9187ac0bae12a03585083169e34dc7a197d.
2024-07-24 08:00:27 -05:00
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Ed Page
99fae9187a fix: Ensure dep/feature activates the dependency on 2024
This doesn't revert the last commit of #14018 so that it works properly
on Editions 2021 and 2024.

Fixes #14016
2024-07-09 13:51:43 -05:00
Ed Page
85cc9940af test: Show bad error for dep_name/feature_name on 2024 2024-07-09 13:43:33 -05:00
bors
838d81d0e0 Auto merge of #14026 - linyihai:weak-optional-inactive, r=weihanglo
fix: improve message for inactive weak optional feature with edition2024 through unused dep collection

### What does this PR try to resolve?

Collect the unused dependencies to check whether a weak optional dependency had set. Then we can improve the message when weak optional dependency inactive.

Fixes https://github.com/rust-lang/cargo/issues/14015

### How should we test and review this PR?

One commit test added, one commit fixed and updated

### Additional information
Part of https://github.com/rust-lang/cargo/issues/14039
- migrate `tests/testsuite/lints/unused_optional_dependencies.rs` to snapshot

And rename `MissingField` to `MissingFieldError`
2024-07-03 14:24:48 +00:00
Lin Yihai
b28eef9651 feat: Add missing_dep_diagnostic thanks to @Muscraft 2024-07-03 11:43:50 +08:00
eth3lbert
bf3ca3cc64
test: replace glob with explicit unordered calls 2024-06-29 07:59:35 +08:00
eth3lbert
ea04b5c483
test: migrate features to snapbox 2024-06-19 18:12:43 +08:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Ed Page
8520ec63b6 test(toml): Centralize underscore field tests 2024-04-18 14:38:05 -05:00
Ed Page
3fc52d53b1 test(toml): Make test names scale to more scenarios 2024-04-18 14:35:39 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Scott Schafer
0d62ae2fc3
feat: Add rustc style errors for manifest parsing 2023-12-15 13:30:10 -07:00
Weihang Lo
a3267bfa29
refactor(util-schemas): error type for restricted_names 2023-12-20 10:38:02 -05:00
Ed Page
c1d9b76401 fix: Improve feature name errors
This moves feature name validation early enough in the process to get
TOML errors.
2023-12-13 10:53:40 -06:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
bors
2ef56214b3 Auto merge of #12939 - hi-rustin:rustin-patch-feature-msg, r=epage
Fix the invalidate feature name message
2023-11-08 17:15:01 +00:00
hi-rustin
976835d045 Update the test for the msg change
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-11-08 23:40:24 +08:00
hi-rustin
d61816465f Add test for empty feature name
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-11-08 22:52:35 +08:00
David Tolnay
649a14d470
Add regression test for issue 6915: features and transitive dev deps 2023-11-01 14:22:16 -07:00
Eric Huss
9835622853 Convert valid feature name warning to an error. 2023-06-20 12:39:27 -07:00
Scott Schafer
a5ec7e0266 chore: update features tests to use check 2023-02-20 12:21:15 -06:00
Dinu Blanovschi
2071acd5ec Add -v to some feature tests 2022-12-28 18:44:05 +01:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Scott Schafer
cda5f82498 add preloading for workspace packages in resolve_with_previous so manifests aren't parsed twice 2022-06-16 15:34:22 -05:00
hi-rustin
8b895cc80b Use warn_on_deprecated
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-10 00:08:28 +08:00
hi-rustin
460ea25377 Warning on conflicting default_features keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
Eric Huss
43a063c80a Stabilize namespaced and weak dependency features. 2022-01-06 15:56:56 -08:00
Eric Huss
85854b1884 Refactor feature handling, and improve error messages. 2021-03-19 14:59:53 -07:00
Eric Huss
d087aeb845 Stabilize -Zfeatures and -Zpackage-features. 2020-12-19 08:26:42 -08:00
Eric Huss
ea1a73a121 Add period to allowed feature name characters. 2020-12-02 07:56:44 -08:00
Eric Huss
b731190daa Add a future-compatibility warning on allowed feature name characters. 2020-10-27 14:23:35 -07:00
Eric Huss
bcfdf9fbad New namespaced features implementation. 2020-10-23 16:04:41 -07:00
Eric Huss
2611f5c73c Move namespaced features tests to a separate file. 2020-10-23 16:04:41 -07:00
Ivan Tham
fd5902c6ca
Fix help message in features.rs test 2020-10-14 10:21:37 +08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Alex Tokarev
19a9579031 Warn on missing required-features
Co-authored-by: Eric Huss <eric@huss.org>
2020-07-26 13:01:18 +03:00
Alex Crichton
6514c289d2 Improve git error messages a bit
This commit is targeted at further improving the error messages
generated from git errors. For authentication errors the actual URL
fetched is now printed out as well if it's different from the original
URL. This should help handle `insteadOf` logic where SSH urls are used
instead of HTTPS urls and users can know to track that down.

Otherwise the logic about recommending `net.git-fetch-with-cli` was
tweaked a bit and moved to the same location as the rest of our error
reporting.

Note that a change piggy-backed here as well is that `Caused by:` errors
are now automatically all tabbed over a bit instead of only having the
first line tabbed over. This required a good number of tests to be
updated, but it's just an updated in renderings.
2020-06-25 08:47:15 -07:00