Commit graph

14852 commits

Author SHA1 Message Date
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
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
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
bors d7ee2608bd Auto merge of #12549 - rust-lang:renovate/latest-msrv-1.x, r=ehuss
chore(deps): update latest msrv to v1.72.0

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [latest-msrv](https://togithub.com/rust-lang/rust) | minor | `1.71.0` -> `1.72.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (latest-msrv)</summary>

### [`v1.72.0`](https://togithub.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1720-2023-08-24)

[Compare Source](https://togithub.com/rust-lang/rust/compare/1.71.0...1.72.0)

\==========================

<a id="1.72.0-Language"></a>

## Language

-   [Replace const eval limit by a lint and add an exponential backoff warning](https://togithub.com/rust-lang/rust/pull/103877/)
-   [expand: Change how `#![cfg(FALSE)]` behaves on crate root](https://togithub.com/rust-lang/rust/pull/110141/)
-   [Stabilize inline asm for LoongArch64](https://togithub.com/rust-lang/rust/pull/111235/)
-   [Uplift `clippy::undropped_manually_drops` lint](https://togithub.com/rust-lang/rust/pull/111530/)
-   [Uplift `clippy::invalid_utf8_in_unchecked` lint](https://togithub.com/rust-lang/rust/pull/111543/)
-   [Uplift `clippy::cast_ref_to_mut` lint](https://togithub.com/rust-lang/rust/pull/111567/)
-   [Uplift `clippy::cmp_nan` lint](https://togithub.com/rust-lang/rust/pull/111818/)
-   [resolve: Remove artificial import ambiguity errors](https://togithub.com/rust-lang/rust/pull/112086/)
-   [Don't require associated types with Self: Sized bounds in `dyn Trait` objects](https://togithub.com/rust-lang/rust/pull/112319/)

<a id="1.72.0-Compiler"></a>

## Compiler

-   [Remember names of `cfg`-ed out items to mention them in diagnostics](https://togithub.com/rust-lang/rust/pull/109005/)
-   [Support for native WASM exceptions](https://togithub.com/rust-lang/rust/pull/111322/)
-   [Add support for NetBSD/aarch64-be (big-endian arm64).](https://togithub.com/rust-lang/rust/pull/111326/)
-   [Write to stdout if `-` is given as output file](https://togithub.com/rust-lang/rust/pull/111626/)
-   [Force all native libraries to be statically linked when linking a static binary](https://togithub.com/rust-lang/rust/pull/111698/)
-   [Add Tier 3 support for `loongarch64-unknown-none*`](https://togithub.com/rust-lang/rust/pull/112310/)
-   [Prevent `.eh_frame` from being emitted for `-C panic=abort`](https://togithub.com/rust-lang/rust/pull/112403/)
-   [Support 128-bit enum variant in debuginfo codegen](https://togithub.com/rust-lang/rust/pull/112474/)
-   [compiler: update solaris/illumos to enable tsan support.](https://togithub.com/rust-lang/rust/pull/112039/)

Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.

<a id="1.72.0-Libraries"></a>

## Libraries

-   [Document memory orderings of `thread::{park, unpark}`](https://togithub.com/rust-lang/rust/pull/99587/)
-   [io: soften ‘at most one write attempt’ requirement in io::Write::write](https://togithub.com/rust-lang/rust/pull/107200/)
-   [Specify behavior of HashSet::insert](https://togithub.com/rust-lang/rust/pull/107619/)
-   [Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>`](https://togithub.com/rust-lang/rust/pull/111074/)
-   [Update runtime guarantee for `select_nth_unstable`](https://togithub.com/rust-lang/rust/pull/111974/)
-   [Return `Ok` on kill if process has already exited](https://togithub.com/rust-lang/rust/pull/112594/)
-   [Implement PartialOrd for `Vec`s over different allocators](https://togithub.com/rust-lang/rust/pull/112632/)
-   [Use 128 bits for TypeId hash](https://togithub.com/rust-lang/rust/pull/109953/)
-   [Don't drain-on-drop in DrainFilter impls of various collections.](https://togithub.com/rust-lang/rust/pull/104455/)
-   [Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadata](https://togithub.com/rust-lang/rust/pull/106450/)

<a id="1.72.0-Rustdoc"></a>

## Rustdoc

-   [Allow whitespace as path separator like double colon](https://togithub.com/rust-lang/rust/pull/108537/)
-   [Add search result item types after their name](https://togithub.com/rust-lang/rust/pull/110688/)
-   [Search for slices and arrays by type with `[]`](https://togithub.com/rust-lang/rust/pull/111958/)
-   [Clean up type unification and "unboxing"](https://togithub.com/rust-lang/rust/pull/112233/)

<a id="1.72.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`impl<T: Send> Sync for mpsc::Sender<T>`](https://doc.rust-lang.org/stable/std/sync/mpsc/struct.Sender.html#impl-Sync-for-Sender%3CT%3E)
-   [`impl TryFrom<&OsStr> for &str`](https://doc.rust-lang.org/stable/std/primitive.str.html#impl-TryFrom%3C%26'a+OsStr%3E-for-%26'a+str)
-   [`String::leak`](https://doc.rust-lang.org/stable/alloc/string/struct.String.html#method.leak)

These APIs are now stable in const contexts:

-   [`CStr::from_bytes_with_nul`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul)
-   [`CStr::to_bytes`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.to_bytes)
-   [`CStr::to_bytes_with_nul`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.to_bytes_with_nul)
-   [`CStr::to_str`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.to_str)

<a id="1.72.0-Cargo"></a>

## Cargo

-   Enable `-Zdoctest-in-workspace` by default. When running each documentation
    test, the working directory is set to the root directory of the package the
    test belongs to.
    [docs](https://doc.rust-lang.org/nightly/cargo/commands/cargo-test.html#working-directory-of-tests)
    [#&#8203;12221](https://togithub.com/rust-lang/cargo/pull/12221)
    [#&#8203;12288](https://togithub.com/rust-lang/cargo/pull/12288)
-   Add support of the "default" keyword to reset previously set `build.jobs`
    parallelism back to the default.
    [#&#8203;12222](https://togithub.com/rust-lang/cargo/pull/12222)

<a id="1.72.0-Compatibility-Notes"></a>

## Compatibility Notes

-   [Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses](https://togithub.com/rust-lang/rust/pull/112606/)
-   Cargo changed feature name validation check to a hard error. The warning was
    added in Rust 1.49. These extended characters aren't allowed on crates.io, so
    this should only impact users of other registries, or people who don't publish
    to a registry.
    [#&#8203;12291](https://togithub.com/rust-lang/cargo/pull/12291)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* * * * *" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzYuNTYuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->
2023-08-24 21:01:07 +00: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
Ed Page 6ac5bb56b3 refactor(add): Pull out rust-version parsing 2023-08-24 13:13:47 -05:00
bors 8c08800172 Auto merge of #12550 - weihanglo:CVE-2023-40030, r=epage
changelog: add link to CVE-2023-40030

* add link to CVE-2023-40030 for 1.72
* add 🚨 emoji for all CVE entries

[Rendered](4b51b27d0a/CHANGELOG.md)
2023-08-24 17:26:09 +00:00
Weihang Lo 4b51b27d0a
changelog: add 🚨 emoji for CVE entries 2023-08-24 18:21:43 +01:00
Weihang Lo f975722a0e
changelog: add link to CVE-2023-40030 2023-08-24 18:21:11 +01:00
renovate[bot] af100af4ff
chore(deps): update latest msrv to v1.72.0 2023-08-24 16:36:51 +00:00
bors 35814255a1 Auto merge of #12547 - epage:install, r=weihanglo
refactor(install): Move value parsing to clap

### What does this PR try to resolve?

Originally, I thought this was going to help some of my other work but it won't.  Instead I decided to finish and post this PR in case there was interest since `@weihanglo` expressed interest in using `Arg::value_parser` more and this demonstrates that.

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

A commit at a time.  There seemed to be existing tests for some of the error changes.
2023-08-24 12:45:03 +00:00
bors 2a159aaa67 Auto merge of #12381 - epage:msrv, r=weihanglo
fix: Set MSRV for internal packages

### What does this PR try to resolve?

Correctly communicates the MSRV we support to our users.

For packages that are more generally mean to be used by other people, I've punted on for now (see ehuss' comment on this PR).  We'll likely need to figure this out for #12432 though

### Additional information

This is prep for a future change which will have us use a fixed rust version for the semver tests with a PR updating them.
2023-08-24 11:01:36 +00:00
bors 82818ab838 Auto merge of #12537 - dario23:fix-link, r=weihanglo
doc: fix two links to tracing docs
2023-08-24 10:17:39 +00:00
Weihang Lo f9eac4b1ae
doc: fix typo 2023-08-24 11:16:26 +01:00
bors afe0f1b8a8 Auto merge of #12548 - tshepang:tshepang-patch-1, r=weihanglo
use AND search when having multiple terms

This makes search more like like common search engines
2023-08-24 08:01:47 +00:00
Tshepang Mbambo ca8b2d0c97
use AND search when having multiple terms
This makes search more like like common search engines
2023-08-24 08:54:09 +02: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
bors 0c51462864 Auto merge of #12542 - epage:trace, r=weihanglo
fix(log): Use a more compact relative-time format

This changes logged messages from
```
2023-08-23T01:01:59.922018Z DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump"
```
To
```
   0.041729583s DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump"
```
Benefits
- Less horizontal space taken up in boilerplate
- Easier to compare within a run

Downsides
- Harder to correlate with other processes, like with crates.io server operations

This gives us up to 4 digits for seconds which should be sufficient for cargo build times.

We could make this more compact by dropping the digits of precision from 9 to 6 but that would require a custom Timer which might be a paint to keep in sync between packages.
2023-08-23 17:55:55 +00:00
Ed Page 488c21005b fix(log): Include process start
I didn't carry this forward to the xtask because they are less likely
needing to be correlated with other events.
2023-08-23 08:42:53 -05:00
Ed Page 576f901f81 fix(log): Use a more compact relative-time format
This changes logged messages from
```
2023-08-23T01:01:59.922018Z DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump"
```
To
```
   0.041729583s DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump"
```
Benefits
- Less horizontal space taken up in boilerplate
- Easier to compare within a run

Downsides
- Harder to correlate with other processes, like with crates.io server
  operations

This gives us up to 4 digits for seconds which should be sufficient for
cargo build times.

We could make this more compact by dropping the digits of precision from
9 to 6 but that would require a custom Timer which might be a paint to
keep in sync between packages.
2023-08-22 20:34:07 -05:00
bors 2cc50bc0b6 Auto merge of #12515 - arlosi:high-pri-last, r=weihanglo
config: merge lists in precedence order

When merging configuration lists, the current order does not match the expected precedence. This makes merged lists follow precedence order, with higher precedence items merged later in lists.

When a list in configuration exists in multiple places, Cargo merges the lists together. The ordering of this merging is unexpected and does not follow the precedence rules that non-list configuration uses.

The current merging order appears to be:
* project-specific `config.toml`
* global `config.toml`
* command-line (`--config`)
* environment variable (`CARGO_*`)

This PR changes the order to follow the precedence rules with higher precedence configuration merging later in the lists.
* global `config.toml`
* project-specific `config.toml`
* environment variable (`CARGO_*`)
* command-line (`--config`)

This aligns with config such as `build.rustflags` where later flags take precedence over earlier ones.

Since `--config` is relatively new, it's unlikely to cause too much breakage by making it come after environment variables.

Switching global and project-specific ordering is more likely to cause breakage, since it's been around longer (reported as an issue in #8128). Projects relying on global configuration flags (in `$CARGO_HOME\config.toml` or in `.cargo/config.toml` further from the project) being merged first in lists will be broken.

For most uses of merged lists (such as `build.rustflags`), if the flags do not conflict with each other, there will be no impact.

Fixes #12506
Fixes #8128
2023-08-22 22:43:08 +00:00
bors 43585c111a Auto merge of #12540 - weihanglo:resolver-tests, r=epage
ci: test `resolver-tests` in a separate job
2023-08-22 21:49:01 +00:00
Ed Page 87b6e0e684 chore: Automate updating of MSRV 2023-08-22 16:46:48 -05:00
Ed Page 7a65c826a0 fix: Set MSRV for internal packages
For now, I'm punting on packages we generally expect others to use
2023-08-22 16:46:47 -05:00
bors 50ba4bfa0c Auto merge of #12529 - weihanglo:clap-suggestions, r=epage
refactor: Use clap to suggest alternative argument for unsupported arguments
2023-08-22 19:18:44 +00:00
Weihang Lo 77da514529
test: move --keep-going suggestion match tests to UI tests
We don't want to overly match to suggestion help from clap.
2023-08-22 19:21:09 +01:00
bors 4df5a17cff Auto merge of #12541 - epage:fix, r=weihanglo
docs(guide): Generalize over VCSs

This is a follow up to #12382
2023-08-22 18:14:05 +00:00
Ed Page a3dc5a1f94 docs(guide): Generalize over VCSs
This is a follow up to #12382
2023-08-22 11:46:30 -05:00
Weihang Lo 4d0958587b
refactor(arg): use UnknownArgumentValueParser to suggest arg for unknown args 2023-08-22 17:24:40 +01:00
Weihang Lo c1f7e2bb04
chore: upgrate clap to 4.3.23 2023-08-22 17:24:40 +01:00
Weihang Lo ba209d6abd
refactor(arg): rename arg_jobs to arg_parallel 2023-08-22 17:24:40 +01:00
bors 5155d3f7dc Auto merge of #12539 - weihanglo:version-bump, r=ehuss
Bump to 0.75.0; update changelog

[rendered](https://github.com/weihanglo/cargo/blob/version-bump/CHANGELOG.md)
2023-08-22 15:19:24 +00:00
Weihang Lo f9920c2750
ci: test resolver-tests in a separate job 2023-08-22 12:52:12 +01:00