Commit graph

3529 commits

Author SHA1 Message Date
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 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 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
Deadbeef 43dccc7535 apply suggestions 2023-08-25 01:43:29 +00:00
Deadbeef b2b34e4ca2 update tests 2023-08-25 01:43:29 +00:00
Ed Page 1701b4e3d8 fix(manifest): Improve rust-version error messages
Since we have tests for a couple of cases, I figured we could
improve the error messages for them.
2023-08-24 20:29:14 -05:00
bors b2c162c067 Auto merge of #12556 - epage:serde, r=arlosi
fix(toml): Improve parse errors

### What does this PR try to resolve?

When we adopted `toml_edit`, we got TOML syntax errors that showed the context for where the error occurred.  However, the work was not done to extend this to semantic errors reported by serde.

This updates `Cargo.toml` and `Cargo.lock` code to provide that context on semantic errors.  `config.toml` is not done because the schema is decentralized.

In theory, this will also improve performance because we aren't having to allocate a lot of intermediate data to then throw away for every `Cargo.toml` we read.

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

Check by commit to see this change gradually.
- The `package.cargo-features` change was made to drop out dependence on `toml::Table` so we could do the direct deserialization
2023-08-24 23:01:52 +00:00
bors 3b20907926 Auto merge of #12551 - arlosi:asymmetric-token, r=Eh2406
Create dedicated unstable flag for asymmetric-token

Asymmetric tokens are gated by `-Zcredential-process`. Since we're considering stabilizing that soon, this moves asymmetric token support to have its own unstable flag.

It was previously gated by `-Zregistry-auth`, and some of the docs were not updated when it moved.

r? `@Eh2406`
2023-08-24 22:07:16 +00:00
Ed Page 53dcd2f454 fix(manifest): Provide more context on sematic errors 2023-08-24 16:27:53 -05:00
Ed Page 8927ea99d1 refactor(manifest): Process the package.cargo-features error in serde 2023-08-24 16:27:45 -05:00
Ed Page 511c17c961 fix(lock): Render source for serde errors
Before, we'd render the source for TOML syntax errors but not semantic errors.
Now we render for both.

Originally I changed `parse_document` to returned `T: DeserializeOwned`
but that adds an extra "could not parse TOML" which is both redundant
and makes it sound like its a syntax issue.
2023-08-24 16:27:37 -05:00
Ed Page 5cac7aa8c6 fix(toml): Remove redundant error messages 2023-08-24 16:19:48 -05:00
Ed Page 423a334520 refactor: Parse, don't validate, rust_version
By using the `PartialVersion` type with serde, we get the context for
the error automatically.
2023-08-24 14:15:35 -05:00
Arlo Siemsen 8c13e9ae3f Create dedicated unstable flag for asymmetric-token 2023-08-24 00:12:50 -05:00
Ed Page 937932520b refactor(install): Move version parsing to the CLI 2023-08-23 16:22:31 -05:00
Ed Page 28b7c846af refactor(install): Shift crate argument parsing to clap 2023-08-23 15:25:05 -05:00
Ed Page dc3722254d fix(update): Improve error on bad argument order
This is inspired by `cargo install`
2023-08-23 14:44:13 -05:00