14890 Commits

Author SHA1 Message Date
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
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
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
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
bors
25050d962e Auto merge of #12270 - BatmanAoD:patch-1, r=weihanglo
Explain how `version` works for `git` dependencies
2023-08-28 16:03:50 +00:00
bors
97e73c75c7 Auto merge of #12574 - dtolnay-contrib:untagged, r=epage
Improve deserialization errors of untagged enums

### What does this PR try to resolve?

```toml
# .cargo/config.toml

[http]
ssl-version.min = false
```

**Before:**

```console
$ cargo check
error: data did not match any variant of untagged enum SslVersionConfig
```

**After:**

```console
$ cargo check
error: error in /path/to/.cargo/config.toml: could not load config key `http.ssl-version`

Caused by:
  error in /path/to/.cargo/config.toml: `http.ssl-version.min` expected a string, but found a boolean
```

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

The first commit adds tests showing the pre-existing error messages — mostly just _"data did not match any variant of untagged enum T"_ with no location information. The second commit replaces all `#[derive(Deserialize)] #[serde(untagged)]` with Deserialize impls based on https://docs.rs/serde-untagged/0.1, showing the effect on the error messages.

Tested with `cargo test`, and by handwriting some bad .cargo/config.toml files and looking at the error produced by `rust-lang/cargo/target/release/cargo check`.
2023-08-28 15:06:20 +00:00
bors
bfa04bb32b Auto merge of #12535 - hi-rustin:rustin-patch-linker, r=weihanglo
Add support for `target.'cfg(..)'.linker`
2023-08-28 06:14:25 +00:00
hi-rustin
c9cc3b99da Add target.<cfg>.linker docs 2023-08-28 10:23:59 +08:00
Kyle J Strand
6bdbe0ab8b Merge branch 'master' of https://github.com/rust-lang/cargo into patch-1 2023-08-27 20:04:57 -06:00
Kyle J Strand
7a7bddb5ad move notes together 2023-08-27 20:03:33 -06:00
hi-rustin
7cbc858b71 Add some tests 2023-08-28 09:29:17 +08:00
hi-rustin
55f0163fb2 Add support for target.'cfg(..)'.linker 2023-08-28 09:28:22 +08:00
David Tolnay
3871aecf3e
Improve deserialization errors of untagged enums 2023-08-27 16:27:08 -07:00
David Tolnay
58d042516e
Fill in more configuration deserialization and manifest deserialization tests 2023-08-27 16:14:29 -07:00
bors
b8df7aa4e8 Auto merge of #12573 - eopb:12557-resolver-warning, r=weihanglo
Improve resolver version mismatch warning

fixes: #12557
2023-08-27 20:38:30 +00:00
Ethan Brierley
1f80ffabd1 Improve resolver version mismatch warning
fixes: #12557
2023-08-27 21:11:20 +01:00
Kyle J Strand
01e1ff0484 Squash:
* Explain how `version` works for `git` dependencies
* Link to multiple-locations, since this is already explained there
* more extensive rewrite
2023-08-27 13:41:28 -06:00
bors
2a6f7f6efe Auto merge of #12568 - dtolnay-contrib:keepgoing, r=weihanglo
Stabilize `--keep-going`

Tracking issue with completed FCP: https://github.com/rust-lang/cargo/issues/10496
2023-08-26 20:44:24 +00:00
David Tolnay
ece5269e97
Stabilize --keep-going 2023-08-26 13:14:39 -07:00
bors
88d4d9481d Auto merge of #12570 - dtolnay-contrib:subcommandtemplate, r=weihanglo
Define {{command}} for use in src/doc/man/includes

I am interested in using this in https://github.com/rust-lang/cargo/pull/12568.

```diff
  {{#option "`--keep-going`"}}
  Build as many crates in the dependency graph as possible, rather than aborting
  the build on the first one that fails to build.

  For example if the current package depends on dependencies `fails` and `works`,
- one of which fails to build, `cargo check -j1` may or may not build the one that
+ one of which fails to build, `cargo {{command}} -j1` may or may not build the one that
  succeeds (depending on which one of the two builds Cargo picked to run first),
- whereas `cargo check -j1 --keep-going` would definitely run both builds, even if
+ whereas `cargo {{command}} -j1 --keep-going` would definitely run both builds, even if
  the one run first fails.
  {{/option}}
```
2023-08-26 19:29:09 +00:00
David Tolnay
134a00cf5e
Strip extra blank lines resulting from *set 2023-08-26 11:50:47 -07:00
David Tolnay
2228ebbcf9
Define {{command}} for use in src/doc/man/includes 2023-08-26 11:50:44 -07:00
bors
8d7376591a Auto merge of #12569 - ehuss:update-serde, r=weihanglo
Update serde

This updates serde to the latest version (essentially reverting #12528). The current lock is preventing publishing of credential crates because they were published with a newer version.
2023-08-26 18:47:12 +00:00
Eric Huss
3b6a008f73 Update serde 2023-08-26 11:40:10 -07:00
bors
b4a770bcb9 Auto merge of #12563 - weihanglo:windows-sys, r=epage
chore: add missing `windows-sys` features back
2023-08-26 11:05:23 +00:00
Weihang Lo
907b9c8ecf
chore: add missing windows-sys features back 2023-08-26 10:59:04 +01:00
bors
925280f028 Auto merge of #12559 - Eh2406:new_rustc, r=weihanglo
string leek is stable

### What does this PR try to resolve?

String leek is now stable so lets use it.

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

Code compiles and test run.
2023-08-25 21:16:44 +00:00
Jacob Finkelman
329af64cc5 string leek is stable 2023-08-25 20:38:33 +00:00
Ed Page
4abd05ea44 test(resolver): Enable msrv-policy
This was kept separate to show that the prior commit didn't change
anything for stable users.
2023-08-25 14:19:22 -05:00
Ed Page
4820624ce7 feat(resolver): Respect MSRV 2023-08-25 10:42:26 -05:00
Ed Page
10196aaee3 test(resolver): Demonstrate existing behavior 2023-08-25 09:59:16 -05: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
bors
e3b3ed8911 Auto merge of #12487 - ehuss:security, r=weihanglo
Contrib: Add process for security responses.

This adds some documentation to give some guidance and checklists for how a security issue is handled.
2023-08-25 07:32:31 +00:00
bors
e2c6a3e0e8 Auto merge of #12421 - fee1-dead-contrib:bindeps-registry2, r=ehuss
Support dependencies from registries for artifact dependencies, take 2

This is a continuation of #12062, and closes #10405.

r? `@ehuss`

Here are things this PR changes:

1. Add information about artifact dependencies to the index. This bumps index_v to 3 for people using bindeps.
2. Make `RustcTargetData` mutable for the feature resolver. This is so that we can query rustc for target info as late as resolving features, as that is when we really know if a package is really going to be used.
2023-08-25 04:08:50 +00:00
Deadbeef
43dccc7535 apply suggestions 2023-08-25 01:43:29 +00:00
Deadbeef
6b65d062a2 format 2023-08-25 01:43:29 +00:00
Deadbeef
b2b34e4ca2 update tests 2023-08-25 01:43:29 +00:00
Deadbeef
0863369ff2 Query RustcTargetData during feature resolution 2023-08-25 01:43:29 +00:00
Deadbeef
3d50f47197 Add fields for bindeps on the registry 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