5544 Commits

Author SHA1 Message Date
Jacob Finkelman
eb188831da
add a missing is:
Co-authored-by: Eric Huss <eric@huss.org>
2023-09-08 15:14:10 -04:00
Ed Page
e539380512 feat: Stabilize lints
Fixes #12115
2023-09-08 10:44:00 -05:00
Arlo Siemsen
803fd6909c fix: don't print _TOKEN suggestion when not applicable
Cargo should not suggest the _TOKEN environment variable
when the cargo:token provider isn't available
2023-09-07 21:14:50 -05:00
Jacob Finkelman
44666f7377 Ues strip_prefix for cleaner code 2023-09-07 17:57:28 +00:00
Weihang Lo
e575448574
refactor: flatten module path of SourceId 2023-09-07 21:06:35 +08:00
Weihang Lo
b6c4e47cc0
refactor: put Source trait under cargo::sources 2023-09-07 21:06:34 +08:00
Eric Huss
f49b038a3f Error out if cargo clean --doc is mixed with -p.
Currently the `-p` is ignored. This should help with any confusion
about the interaction of different flags.
https://github.com/rust-lang/cargo/issues/8790 is tracking to fix this.
2023-09-06 21:42:38 -07:00
bors
d9a4cf1938 Auto merge of #12626 - arlosi:cred-error-both, r=weihanglo
fix: improve warning for both token & credential-provider

Cargo issues a warning when both a `credential-provider` and a `token` are configured for a registry.

This change removes the warning if the `credential-provider` is `cargo:token` since that *will* use the token. The warning message text is also tweaked to include the name of the `credential-provider` that's overriding the token.
2023-09-06 18:02:59 +00:00
Arlo Siemsen
3f004c613c fix: improve error for token & provider 2023-09-06 10:10:02 -05:00
hi-rustin
63ccc35642 Add skip gc glob profile test 2023-09-06 12:51:39 +08:00
bors
d14c85f4e6 Auto merge of #12602 - epage:resolver, r=Eh2406
fix(resolver): Make resolver behavior independent of package order

This address one of the problems mentioned in #12599

The intent behind the `path_pkg` check is to make sure we update
workspace members in the lockfile if their version number changed.
In this case, we don't need to recursively walk, because the change
doesn't affect dependencies.  However, we also shouldn't *prevent*
recursive walks which is what we are doing today, both for packages
marked to keep and for packages that have been "poisoned".  So we fix
this by moving that call after all recursive adds are complete so as to
not interfere with them.

This should not affect `Cargo.lock` at rest, so no upgrade compatibility concerns.

This just allows more packages to be considered available to change which can prevent unclear failures.

The main case I can think of that this does something "undesirable" is when wanting to prevent another "bug" from manifesting: the updating of git dependencies when updating workspace members (#12599).  I think I'm ok with that as that needs to be looked into separately.
2023-09-05 22:28:10 +00:00
Arlo Siemsen
e58b84d35e breaking change(cargo-credential)
Changes the JSON format for cache:expires
2023-09-05 15:22:27 -05:00
Arlo Siemsen
b8099be284 fix: make more credential JSON fields skip_serializing if None 2023-09-05 13:31:23 -05:00
bors
5f40a97e5c Auto merge of #12618 - weihanglo:cleanup-170-debuginfo, r=Muscraft
test: new options of debuginfo are no longer unstable
2023-09-03 16:52:20 +00:00
Weihang Lo
63be1e0d8b
test: new options of debuginfo are no longer unstable 2023-09-01 16:19:47 +01:00
Ed Page
e46379a7f3 fix(remove): Include 'cargo help' suggestion in -h 2023-09-01 09:30:00 -05:00
Ed Page
802cb380ed fix(cli): Be more specific in what is needed 2023-08-31 08:56:16 -05:00
Ed Page
adea3d148e fix(cli): Help people find possible --target values 2023-08-31 08:55:36 -05:00
Ed Page
b87c9323bb refactor(cli): Manually implement missing arg error for --target 2023-08-30 20:42:45 -05:00
Ed Page
801b223135 test(cli): Show existing --target behavior 2023-08-30 20:34:42 -05:00
Ed Page
a78bba7a92 fix(manifest): Improve error on good pre-release 2023-08-30 16:42:08 -05:00
Ed Page
9fb8128d9e test(manifest): Verify error on good pre-release 2023-08-30 16:42:08 -05:00
bors
0bd1f71579 Auto merge of #12593 - epage:help-list, r=ehuss
fix(help): Provide better commands heading for styling

In working on #12578, I felt it would be weird to style the entire statement about commands but it also felt weird to not style it.  So this change explores an alternatively way of communicating the information.
2023-08-30 19:08:23 +00:00
Ed Page
0af2f65ce8 fix(resolver): Make resolver behavior independent of package order
This addresses the ordering issue of for one of the problems from #12599.

The intent behind the `path_pkg` check is to make sure we update
workspace members in the lockfile if their version number changed.
In this case, we don't need to recursively walk, because the change
doesn't affect dependencies.  However, we also shouldn't *prevent*
recursive walks which is what we are doing today, both for packages
marked to keep and for packages that have been "poisoned".  So we fix
this by moving that call after all recursive adds are complete so as to
not interfere with them.
2023-08-30 13:12:52 -05:00
Ed Page
2676a4ae79 test(update): Verify extra-update behavior 2023-08-30 13:07:15 -05:00
Ed Page
31e414cccb fix(help): Provide better commands heading for styling
In working on #12578, I felt it would be weird to style the entire
statement about commands but it also felt weird to not style it.  So
this change explores an alternatively way of communicating the
information.
2023-08-29 15:31:17 -05:00
bors
40f1f67ea6 Auto merge of #12590 - arlosi:cred-unsupported-error, r=epage
fix: add error for unsupported credential provider version

Cargo currently ignores the version in the `CredentialHello` message, and proceeds to use version `1` regardless of what the credential provider claims it can support.

This change does the following:
* Adds a new error if Cargo doesn't support any of the supported protocol versions offered by the provider.
* Kills the credential provider subprocess if it fails. This prevents it from hanging or printing spurious errors such as "broken pipe" when it's attempting to read the next JSON message.
* Adds a new test for an unsupported credential provider protocol.
2023-08-30 03:35:48 +00:00
Arlo Siemsen
39db61e26e fix: add error for unsupported credential provider version 2023-08-29 21:22:29 -05:00
Ed Page
58fb982f44 fix(help): Explain --explain
In working on #12578, I'm focusing on each help string to decide how it
should be handled and I noticed this.  It feels weird to explain
something in terms of another command's CLI, so I took `rustc --help`s
message and added `rustc` to clarify it.

Looking back, the flag was added in #2551 with the message we have
today.  Nothing seems to really be said about it.

In reflecting on this, I'm not 100% convinced and am open to other
opinions.
2023-08-29 15:21:02 -05:00
bors
a873df5c39 Auto merge of #12594 - epage:help-redundant, r=weihanglo
fix(help): Remove redundant information from new/init

Auditing all of the `--help` in prep for #12578 and noticed that we list the VCS information twice, once on our end and once by clap.
2023-08-29 22:36:21 +00:00
Ed Page
ad0a11349e fix(help): Remove redundant information from new/init
Auditing all of the `--help` in prep for #12578 and noticed that we list
the VCS information twice, once on our end and once by clap.
2023-08-29 16:28:49 -05:00
bors
96fe1c9e1a Auto merge of #12584 - epage:lints, r=arlosi
fix(lints): Fail when overriding inherited lints

### What does this PR try to resolve?

Overriding of inherited lints was reserved for the future but as pointed out in https://github.com/rust-lang/cargo/issues/12115#issuecomment-1695293006, we aren't failing on these when we should but silently ignoring the overrides.

This turns it into a hard error.

In fixing this, I had to add a `#[serde(expecting)]` attribute to maintain behavior on an error case (otherwise it would say "expecting struct WorkspaceLints").  Since this drew the error message to my attention, I also tweaked it to make it more specific.

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

Commits are broken down by the relevant tests and fixes to make the intended behavior changes obvious.
2023-08-29 20:10:34 +00:00
bors
333ca23bf8 Auto merge of #12575 - cardoso:missing_git_flag, r=arlosi
cargo install: suggest --git when package name is url

### What does this PR try to resolve?

Improve the error message when specifying a URL for a package name in `cargo install`.

Fixes #10485

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

Just cargo test and trying a common case like `cargo install https://github.com/rust-lang/cargo`

### Additional information

I found this PR after finishing this one: #10522
But it seems have a larger scope to refactor some of the related code.

Perhaps this one would be easier to merge and that one could focus on the refactor, otherwise sorry for the noise and feel free to close.
2023-08-29 19:03:00 +00:00
bors
0b29588c61 Auto merge of #12588 - arlosi:logout-is-stable, r=weihanglo
chore: remove unstable-options for logout

`cargo logout` is stable, and doesn't need `masquerade_as_nightly_cargo`
2023-08-29 18:17:10 +00:00
Arlo Siemsen
bd4444fbdd chore: remove unstable-options for logout 2023-08-29 11:34:29 -05:00
Arlo Siemsen
0a5050c0d0 Improve logout message for asymmetric tokens 2023-08-29 11:28:02 -05:00
Ed Page
c88137cd62 fix(pkgid): More consistently refer to SemVer 2023-08-29 10:49:09 -05:00
Ed Page
4238f689f5 fix(install): More consistently refer to SemVer 2023-08-29 10:49:02 -05:00
Ed Page
3d2f371737 test(pkgid): Add cases for partial versions 2023-08-29 10:40:47 -05:00
Ed Page
018b7589e8 test(pkgid): Focus tests on use cases, rather than success/failure
I assume the reason these aren't all individual tests is test-time but
if we divide by success/failure, I'll need to duplicate things to handle
partial versions.

Overall, I feel like this makes the tests make more sense.
2023-08-29 10:36:36 -05:00
Ed Page
3138f91d4d test(pkgid): Include test for ambiguous spec 2023-08-29 10:29:09 -05:00
Ed Page
82d78097c8 fix(update): Clarify meaning of --aggressive as --recursive
When working on cargo-upgrade, I found the meaning of `--aggressive`
confusing and named it `--recursive` there.

Renaming this in `cargo update` (with a backwards compatible alias) was
referenced in #12425.
2023-08-29 10:18:25 -05:00
Ed Page
66f0b13d47 fix(update): Remove references to -p in help
Missed these in #12545
2023-08-29 08:49:14 -05:00
Ed Page
6568e2c466 fix(lints): Improve error message on bad data 2023-08-28 20:55:29 -05:00
Ed Page
1c578b1a99 fix(lints): Error when overriding workspace lints 2023-08-28 20:34:19 -05:00
Ed Page
c63b51deeb test(lints): Show existing package/workspace mix behavior 2023-08-28 13:59:40 -05:00
Matheus Cardoso
ecf05e4ff1
cargo install: suggest --git when package name is url 2023-08-27 23:04:21 -03:00
Ethan Brierley
1f80ffabd1 Improve resolver version mismatch warning
fixes: #12557
2023-08-27 21:11:20 +01:00
David Tolnay
ece5269e97
Stabilize --keep-going 2023-08-26 13:14:39 -07:00
bors
f797978283 Auto merge of #12553 - epage:version, r=weihanglo
refactor: Pull out cargo-add MSRV code for reuse

### What does this PR try to resolve?

#12078 added MSRV code in `cargo add`. Our assumption when writing it is that we'd need to generalize the code before reusing it in other places, like `cargo install`.  This PR focused purely on that refactor because I'm hopeful it will be useful for other work I'm doing.  Despite not having a user for this yet, I think the `cargo install` case is inevitable and I feel this does a bit to clean up MSRV related code by using a more specific type everywhere.

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

Each commit gradually progresses things along
2023-08-25 14:56:24 +00:00