Commit graph

14981 commits

Author SHA1 Message Date
Ed Page ca173bc32d refactor(tree): Lookup --target like other commands 2023-08-30 20:41:45 -05:00
Ed Page 92e252bad8 refactor(cli): Allow --targets to fail 2023-08-30 20:36:24 -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 6031cdaec0 Auto merge of #12604 - Eh2406:to_string, r=epage
Fewer temporary needless strings

### What does this PR try to resolve?

I noticed a few places where we were using `InternedString::to_string()` in places where we just needed a hash key or to display it. In these situations we could avoid a memory allocation by using the `InternedString` directly. I used the clippy `disallowed-methods` to look through all of the places who called `to_string` on an `InternedString`, and fixed all the places where it was a straightforward change to remove it. I don't think any of them matter in practice. But doing less work can't hurt.

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

This was an internal re-factor, and the tests still pass.
2023-08-30 21:09:38 +00:00
Jacob Finkelman fde2337ccd Fewer temporary needless strings 2023-08-30 20:50:52 +00: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
bors 743d4ab2f0 Auto merge of #12544 - epage:recursive, r=weihanglo
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-30 18:08:29 +00:00
Ed Page 2676a4ae79 test(update): Verify extra-update behavior 2023-08-30 13:07:15 -05:00
bors 27619492f2 Auto merge of #12601 - epage:tone, r=weihanglo
docs(changelog): Clarify language for Cargo.lock policy
2023-08-30 16:21:05 +00:00
Ed Page fc4a81db82 docs(changelog): Clarify language for Cargo.lock policy 2023-08-30 10:50:49 -05:00
bors 4d8d461c9e Auto merge of #12598 - sillykelvin:fix-typo, r=hi-rustin
fix typo: "default branch branch" -> "default branch"

Fix a typo in the doc about git dependencies, I think the second "branch" word might not be needed.
2023-08-30 13:08:46 +00:00
Kelvin Hu 4996627fbd
fix typo: "default branch branch" -> "default branch" 2023-08-30 17:42:39 +08: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
bors 1da01e59a9 Auto merge of #12592 - epage:explain, r=weihanglo
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-30 00:01:28 +00:00
Weihang Lo b68ed8a772
doc: adjust all doc headings one level up 2023-08-30 00:01:56 +01: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
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
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 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
bors e597acd598 Auto merge of #12587 - arlosi:paseto-logout, r=epage
Improve logout message for asymmetric tokens

When doing `cargo logout` with an asymmetric token, it currently always succeeds with no message printed.

This changes the `cargo:paseto` provider to match the other providers and respond with `NotFound` if the user is not logged in. It also adds a message to indicate that the token was successfully removed (if it existed).
2023-08-29 16:41:44 +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
bors 87a14ed1c6 Auto merge of #12586 - epage:positional, r=weihanglo
fix(update): Remove references to -p in help

Missed these in #12545
2023-08-29 14:11:19 +00: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 679cb3256d refactor(lints): Simplify package processing 2023-08-28 20:34:19 -05:00
bors 94770a5586 Auto merge of #12545 - epage:positional, r=weihanglo
fix(update): Make `-p` more convenient by being positional

Generally, cargo avoids positional arguments.  Mostly for the commands that might forward arguments to another command, like `cargo test`. It also allows some flexibility in turning flags into options.

For `cargo add` and `cargo remove`, we decided to accept positionals because the motivations didn't seem to apply as much (similar to `cargo install`).

This applies the pattern to `cargo update` as well which is in the same category of commands as `cargo add` and `cargo remove`.

As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like other positionals or should be relegated to "Package selection".  I went with the latter mostly to make it easier to visualize the less common choice.

Switching to a positional for `cargo update` (while keeping `-p` for backwards compatibility) was referenced in #12425.
2023-08-29 01:11:03 +00:00
bors 552209137b Auto merge of #12582 - ehuss:network-target, r=epage
Set tracing target for networking messages.

This changes the log messages for messages related to network traffic to use the "network" tracing target. This makes it easier to do `CARGO_LOG=network=trace CARGO_HTTP_DEBUG=true` instead of trying to figure out which modules to include (and to avoid `CARGO_LOG=trace` which can be too noisy). For example, #12290 moved the location of some log messages to a different module, which broke the documented workflow of using `CARGO_LOG=cargo::ops::registry=debug` to get networking information.
2023-08-28 23:46:05 +00:00
bors e05e43a0f0 Auto merge of #12583 - ehuss:retry-docs, r=epage
Retry docs

This adds some more documentation to the `retry` module.

(Also removes a stray log message that should not have been committed).
2023-08-28 22:50:45 +00:00
Eric Huss c1130f6d19 Add some more docs to the retry module. 2023-08-28 15:17:26 -07:00
Eric Huss 4ea6bcb592 Remove a debug log message that was not intended to be added.
This was a temporary debug log message I added a long while ago, and
apparently missed removing it when posting the PR.
2023-08-28 15:04:10 -07:00
Eric Huss f0176a1955 Set tracing target for networking messages. 2023-08-28 15:03:26 -07:00
Matheus Cardoso 40dae6123a
only suggest --git flag if scheme is http(s) 2023-08-28 18:47:30 -03:00
bors 0c2b370b35 Auto merge of #12560 - epage:msrv, r=🙈eh2406🙈
feat(resolver): **Very** preliminary MSRV resolver support

### What does this PR try to resolve?

A bare bones implementation of an MSRV resolver that is good enough for people running on nightly when they really need it but is not ready for general use.

Current limitations
- Does not honor `--ignore-version`
- Gives terrible error messages
- Nothing is done yet regarding `cargo install`
- Doesn't inform the user when choosing non-latest

These will be  noted in #9930 on merge.

Implementation wise, this is yet another hack (sorry `@Eh2406).`  Our expectation to get this GA is to refactor the resolver to make the cargo/resolver boundary look a little more like the cargo/pubgrub boundary so we can better control policy without any of these hacks which will also make having all of the policy we need for this easier to maintain.

This is a part of #9930

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

Per commit
2023-08-28 21:11:20 +00:00
bors edb5281432 Auto merge of #12580 - ehuss:update-git2, r=epage
Update git2

This is a routine update of libgit2.
Changelog: https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md#0180---2023-08-28

There is a pretty large number of changes, but I don't think any of them are particularly of interest in terms of changes users will see. Most of the changes are opt-in and we don't opt-in to them (SHA256, Windows schannel, or shallow clone).
2023-08-28 20:26:53 +00:00
Eric Huss 58b5951d9f Update git2 2023-08-28 13:17:01 -07:00