Commit Graph

8940 Commits

Author SHA1 Message Date
bors eb9d3caf05 Auto merge of #154253 - JonathanBrouwer:rollup-LLZUsz2, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#154241 (`rust-analyzer` subtree update)
 - rust-lang/rust#153686 (`std`: include `dlmalloc` for all non-wasi Wasm targets)
 - rust-lang/rust#154105 (bootstrap: Pass `--features=rustc` to rustc_transmute)
 - rust-lang/rust#153069 ([BPF] add target feature allows-misaligned-mem-access)
 - rust-lang/rust#154085 (Parenthesize or-patterns in prefix pattern positions in pretty printer)
 - rust-lang/rust#154191 (refactor RangeFromIter overflow-checks impl)
 - rust-lang/rust#154207 (Refactor query loading)
 - rust-lang/rust#153540 (drop derive helpers during attribute parsing)
 - rust-lang/rust#154140 (Document consteval behavior of ub_checks, overflow_checks, is_val_statically_known.)
 - rust-lang/rust#154161 (On E0277 tweak help when single type impls traits)
 - rust-lang/rust#154218 (interpret/validity: remove unreachable error kind)
 - rust-lang/rust#154225 (diagnostics: avoid ICE in confusable_method_name for associated functions)
 - rust-lang/rust#154228 (Improve inline assembly error messages)
2026-03-23 15:46:13 +00:00
Jonathan Brouwer e8b594b427 Rollup merge of #153936 - danielzgtg:perf/immediateAbortAvoidPthreadGetattrNp, r=Mark-Simulacrum
Skip stack_start_aligned for immediate-abort

This improves startup performance by 16%, shown by an optimized hello-world program. glibc's `pthread_getattr_np` performs expensive syscalls when reading `/proc/self/maps`. That is all wasted with `panic = immediate-abort` active because `init()` immediately discards the return value from `install_main_guard()`. A similar improvement can be seen in environments that don't have `/proc`. This change is safe because the immediately succeeding comment says that we rely on Linux's "own stack-guard mechanism".

Tracking issue: https://github.com/rust-lang/rust/issues/147286

# Benchmark

Set it up with `cargo new hello-world2`, and replace these files:

```toml
# Cargo.toml
cargo-features = ["panic-immediate-abort"]

[package]
name = "hello-world"
version = "0.1.0"
edition = "2024"

[profile.release]
lto = true
panic = "immediate-abort"
codegen-units = 1
opt-level = "z"
strip = true

# .cargo/config.toml
[unstable]
build-std = ["std"]
```

## Before

```console
home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     524.8 µs ±  65.1 µs    [User: 276.1 µs, System: 187.0 µs]
  Range (min … max):   446.4 µs … 975.5 µs    3996 runs

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     519.4 µs ±  65.8 µs    [User: 282.1 µs, System: 177.7 µs]
  Range (min … max):   443.2 µs … 830.5 µs    3612 runs

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     520.0 µs ±  64.3 µs    [User: 277.1 µs, System: 182.1 µs]
  Range (min … max):   447.1 µs … 1001.3 µs    3804 runs
```

For a visualization of the problem, run `cargo +stage1 build --release && perf record --call-graph dwarf -F max ./target/release/hello-world2 && perf script | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg`:

<img width="3832" height="1216" alt="flamegraph with 17.41% __pthread_getattr_np" src="https://github.com/user-attachments/assets/acc2286e-1582-4772-9e3b-68b5c35e3e70" />

## After

```console
home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     444.7 µs ±  57.3 µs    [User: 257.4 µs, System: 130.2 µs]
  Range (min … max):   379.4 µs … 1289.3 µs    3893 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     452.3 µs ±  60.7 µs    [User: 261.5 µs, System: 133.5 µs]
  Range (min … max):   374.9 µs … 1512.4 µs    4177 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     441.2 µs ±  56.1 µs    [User: 256.2 µs, System: 128.8 µs]
  Range (min … max):   375.0 µs … 760.4 µs    4032 runs
```
2026-03-23 12:14:58 +01:00
Jonathan Brouwer 32fccd8826 Rollup merge of #153647 - TKanX:docs/153618-file-lock-cross-process, r=Mark-Simulacrum
docs(fs): Clarify That File::lock Coordinates Across Processes

### Summary:

The documentation for `lock`, `lock_shared`, `try_lock`, and `try_lock_shared` did not make it clear that these are OS level file locks that coordinate access across processes, not just between handles within the current process.

Add "in this or any other process" to each method's existing description to clarify this.

Fixes rust-lang/rust#153618

r? @Mark-Simulacrum
2026-03-23 12:14:57 +01:00
Jonathan Brouwer 9650f0d723 Rollup merge of #153623 - joboet:move_pal_os, r=Mark-Simulacrum
std: move `sys::pal::os` to `sys::paths`

Part of rust-lang/rust#117276.

After rust-lang/rust#150723, rust-lang/rust#153130, rust-lang/rust#153341 and rust-lang/rust#153413, `sys::pal::os` only contains default-path related functions (like `getcwd` and the `PATH`-splitting logic). In line with rust-lang/rust#117276, this PR thus moves all these implementations into a new module in `sys`: `sys::paths`.

~There is one functional change here: The `chdir` implementation on SGX used to use `sgx_ineffective` which silently fails, but now returns an error unconditionally – I think that's much more reasonable given that SGX doesn't support filesystem stuff at all.~

I've corrected the misleading panic messages in `temp_dir` for UEFI and WASI, aside from that, this PR only consists of code moves.

CC @jethrogb @raoulstrackx @aditijannu for the SGX change (resolved)
2026-03-23 12:14:57 +01:00
Jonathan Brouwer 5b2cad5162 Rollup merge of #153491 - ChrisDenton:openoptionsext2, r=Mark-Simulacrum
Move `freeze_*` methods to `OpenOptionsExt2`

Move the unstable `freeze_last_access_time` and `freeze_last_write_time` from `OpenOptionsExt` to a new `OpenOptionsExt2` trait. This should fix rust-lang/rust#153486.
2026-03-23 12:14:56 +01:00
Jonathan Brouwer 18815ba852 Rollup merge of #153718 - asomers:environ-freebsd, r=Mark-Simulacrum
Fix environ on FreeBSD with cdylib targets that use -Wl,--no-undefined .

Instead of relying on the linker to find the 'environ' symbol, use dlsym.  This fixes using `environ` from cdylibs that link with `-Wl,--no-undefined` .

Fixes rust-lang/rust#153451
Sponsored by:	ConnectWise
2026-03-23 12:14:53 +01:00
Jonathan Brouwer f2ab755178 Rollup merge of #153534 - Zalathar:flaky-stress, r=Mark-Simulacrum
Remove a flaky `got_timeout` assert from two channel tests

In CI, the receiver thread can be descheduled for a surprisingly long time, so there's no guarantee that a timeout actually occurs.

One of these tests actually failed in https://github.com/rust-lang/rust/pull/153387#issuecomment-4016078983.

Earlier failures:
- https://github.com/rust-lang/rust/pull/150365#issuecomment-3691457455
- https://github.com/rust-lang/rust/pull/147775#issuecomment-3410454391

---

- Prior art: https://github.com/rust-lang/rust/pull/152878
2026-03-23 12:14:53 +01:00
Jonathan Brouwer 9177dbe7ff Rollup merge of #153686 - Twey:patch-1, r=Mark-Simulacrum
`std`: include `dlmalloc` for all non-wasi Wasm targets

Currently, building std for a custom Wasm target with an OS other than `unknown` will fail, because `sys/alloc/mod.rs` will attempt to use `sys/alloc/wasm.rs`, the dlmalloc-based allocator used on `wasm32-unknown-unknown`.  However, currently dlmalloc is only pulled in when `target_os = "unknown"`.

Instead, we should make `Cargo.toml` and `alloc/mod.rs` match: either
- disable `wasm.rs` in `alloc/mod.rs` where `not(target_os = "unknown")`, or
- pull in `dlmalloc` for all Wasm targets with  `target_family = "wasm32"` that aren't covered by the [upper branches of `alloc/mod.rs`](https://github.com/rust-lang/rust/blob/main/library/std/src/sys/alloc/mod.rs#L72-L100).

This PR takes the latter approach, because it allows more code to compile without a custom allocator.
2026-03-23 12:00:57 +01:00
bors e52f547ed4 Auto merge of #154160 - JonathanBrouwer:rollup-4jbkEbt, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#154154 (Emit fewer errors for incorrect rtn and `=` -> `:` typos in bindings)
 - rust-lang/rust#154155 (tests/ui/async-await/drop-option-future.rs: New regression test)
 - rust-lang/rust#146961 (Allow passing `expr` metavariable as `cfg` predicate)
 - rust-lang/rust#154118 (don't suggest non-deriveable traits for unions)
 - rust-lang/rust#154120 (Start migrating `DecorateDiagCompat::Builtin` items to `DecorateDiagCompat::Dynamic`)
 - rust-lang/rust#154156 (Moving issue-52049 to borrowck)
2026-03-21 07:20:47 +00:00
Jonathan Brouwer b9f8e25f6e Rollup merge of #146961 - Jules-Bertholet:expr-cfg, r=JonathanBrouwer
Allow passing `expr` metavariable as `cfg` predicate

This PR allows expanding `expr` metavariables inside the configuration predicates of `cfg` and `cfg_attr` invocations.
For example, the following code will now compile:

```rust
macro_rules! mac {
    ($e:expr) => {
        #[cfg_attr($e, inline)]
        #[cfg($e)]
        fn func() {}

        #[cfg(not($e))]
        fn func() {
            panic!()
        }
    }
}

mac!(any(unix, feature = "foo"));
```

There is currently no `macro_rules` fragment specifier that can represent all valid `cfg` predicates. `meta` comes closest, but excludes `true` and `false`. By fixing that, this change makes it easier to write declarative macros that parse `cfg` or `cfg_attr` invocations, for example https://github.com/rust-lang/rust/pull/146281/.

@rustbot label T-lang needs-fcp A-attributes A-cfg A-macros
2026-03-21 00:42:47 +01:00
Daniel Tang 577dba9093 Skip stack_start_aligned for immediate-abort
This improves startup performance by 16%, shown by an optimized
hello-world program. glibc's `pthread_getattr_np` performs expensive
syscalls when reading `/proc/self/maps`. That is all wasted with
`panic = immediate-abort` active because `init()` immediately discards
the return value from `install_main_guard()`. A similar improvement can
be seen in environments that don't have `/proc`. This change is safe
because the immediately succeeding comment says that we rely on Linux's
"own stack-guard mechanism".
2026-03-20 15:55:17 -04:00
Ralf Jung 9dfdb6b4bc test copy_specializes_from_vecdeque: reduce iteration count for Miri 2026-03-20 15:55:56 +01:00
Stuart Cook 83d921de92 Rollup merge of #154019 - cyrgani:feature-clean, r=joboet
two smaller feature cleanups

Remove an unneeded feature gate for a private macro and sort the used features correctly by whether they are language or library features.
2026-03-20 15:33:07 +11:00
Jonathan Brouwer 981f837e2d Rollup merge of #153170 - LevitatingBusinessMan:is_disconnected, r=Mark-Simulacrum
Add is_disconnected functions to mpsc and mpmc channels

Add `is_disconnected()` functions to the `Sender` and `Receiver` of both `mpmc` an `mpsc` channels.

```rust
std::sync::mpmc::Sender<T>::is_disconnected(&self) -> bool
std::sync::mpmc::Receiver<T>::is_disconnected(&self) -> bool

std::sync::mpsc::Sender<T>::is_disconnected(&self) -> bool
std::sync::mpsc::Receiver<T>::is_disconnected(&self) -> bool
```

The `mpsc` methods are locked behind the `mpsc_is_disconnected` feature gate, which has no tracking issue yet.

ACP: https://github.com/rust-lang/libs-team/issues/748
Tracking issue: https://github.com/rust-lang/rust/issues/153668
2026-03-19 13:42:33 +01:00
Jonathan Brouwer 2c49023125 Rollup merge of #153333 - gautam899:main, r=Mark-Simulacrum
Fix bootstrap rust build failure for vxworks

Fixes rust-lang/rust#153332

Starting with VxWorks 25.09, struct stat was updated to use struct timespec instead of time_t for timestamp fields.

The following changes were made in libc in the commit [libc](https://github.com/rust-lang/libc/pull/4781).

As a result, when performing a bootstrap build with VxWorks ≥ 25.09, libc no longer exposes the fields st_mtime, st_atime, and st_ctime, as they are conditionally compiled in src/vxworks/mod.rs here [libc](https://github.com/rust-lang/libc/blob/56caa81b6b433c49c5704bf0400a02d428cfacda/src/vxworks/mod.rs#L229). This causes the build to fail.

For VxWorks versions earlier than 25.09, the build completes successfully without errors.

This PR resolves the issue by detecting the WIND_RELEASE_ID environment variable (which is set in the VxWorks build environment) and conditionally guarding the affected functions in the two additional files where the errors originate.
2026-03-19 13:42:25 +01:00
Jonathan Brouwer b1050a74cc Rollup merge of #152998 - xtqqczze:panic-truncate, r=jhpratt
std: make `OsString::truncate` a no-op when `len > current_len`

Align `OsString::truncate` (and the underlying WTF-8 implementation) with `String::truncate` by making it a no-op when `len > self.len()`.

Previously, `OsString::truncate` would panic if `len > self.len()`, while `String::truncate` treats such cases as a no-op.

Tracking (`os_string_truncate`): https://github.com/rust-lang/rust/issues/133262
See also: https://github.com/rust-lang/rust/pull/32977

cc: @alexcrichton, @lolbinarycat
2026-03-17 21:20:01 +01:00
cyrgani e350a56cf9 move features into the correct section 2026-03-17 09:31:03 +00:00
Jules Bertholet 7f83c784bd Allow passing expr metavariable as a cfg predicate 2026-03-15 13:44:14 -04:00
Jules Bertholet c5c1d94e6c Add From impls for wrapper types
- `From<T> for ThinBox<T>`
- `From<T> for UniqueRc<T>`
- `From<T> for UniqueArc<T>`
- `From<T: UnwindSafe> for AssertUnwindSafe<T>`
- `From<T> for LazyCell<T, F>`
- `From<T> for LazyLock<T, F>`
2026-03-14 22:09:35 -04:00
Bhavya Gautam 24d86b5f2b Fix rust build failure for vxworks 2026-03-14 17:54:19 +05:30
Stuart Cook 4b35702611 Rollup merge of #153774 - sardok:fix_sgx_std_doctest_build, r=WaffleLapkin
Fix std doctest build for SGX target.

This PR fixes standard library doctest build for `x86_64-fortanix-unknown-sgx` target.
2026-03-14 17:30:24 +11:00
Sinan Nalkaya 8459d6bf3a Fix std doctest build for SGX target. 2026-03-12 15:49:13 +01:00
James Kay e2923eb86a std: don't depend on dlmalloc when cfg(unix) 2026-03-11 16:49:12 +00:00
Ralf Jung bc4dfa5e33 miri-test-libstd: use --tests and update some comments 2026-03-11 15:17:23 +01:00
James Kay e108da9dc2 std: include dlmalloc for all non-wasi Wasm targets
Currently, building std for a custom Wasm target with an OS other than `unknown` will fail, because `sys/alloc/mod.rs` will attempt to use `sys/alloc/wasm.rs`, the dlmalloc-based allocator used on `wasm32-unknown-unknown`.  However, currently dlmalloc is only pulled in when `target_os = "unknown"`.

Instead, we should make `Cargo.toml` and `alloc/mod.rs` match: either
- disable `wasm.rs` in `alloc/mod.rs` where `not(target_os = "unknown")`, or
- pull in `dlmalloc` for all Wasm targets with  `target_family = "wasm32"` that aren't covered by the [upper branches of `alloc/mod.rs`](https://github.com/rust-lang/rust/blob/main/library/std/src/sys/alloc/mod.rs#L72-L100).

This PR takes the latter approach, because it allows more code to compile without a custom allocator.
2026-03-11 02:25:56 +00:00
LevitatingBusinessMan (Rein Fernhout) ce2de643fc assign mpsc_is_disconnected issue 153668 2026-03-10 19:21:19 +01:00
Chris Denton fb65707d32 Move freeze_* methods to OpenOptionsExt2 2026-03-10 09:52:43 +00:00
Tony Kan 0e0babcc5e docs(fs): Clarify that File::lock coordinates across processes 2026-03-10 01:09:08 -07:00
joboet be5f0708e4 std: move sys::pal::os to sys::paths 2026-03-10 00:05:20 +01:00
joboet f4a95d35d3 std: move leftover Windows error test 2026-03-10 00:01:27 +01:00
joboet d2e3ab641a std: move sys::pal::os to sys::paths (rename/delete only) 2026-03-10 00:00:57 +01:00
Alan Somers 44d6cd2344 Fix environ on FreeBSD with cdylib targets that use -Wl,--no-undefined .
Instead of relying on the linker to find the 'environ' symbol, use
dlsym.

Fixes #153451
Sponsored by:	ConnectWise
2026-03-09 09:19:36 -06:00
Jonathan Brouwer b8e01edc24 Rollup merge of #153413 - joboet:organize-pal-os, r=Mark-Simulacrum
std: organise `sys::pal::os`

Continuing rust-lang/rust#153341, this moves around some functions in `sys::pal`, so that `pal::os` only contains standard-path-related code (which I'll move later as part of rust-lang/rust#117276).

Best reviewed commit-by-commit.
2026-03-09 11:49:22 +01:00
Jonathan Brouwer 1ef29e7af6 Rollup merge of #152535 - joboet:xous_env_once_lock, r=Mark-Simulacrum
std: use `OnceLock` for Xous environment variables

There's no need for exposed-provenance-shenanigans here...

CC @xobs
2026-03-08 22:51:51 +01:00
Josh Stone 78157ddde9 Replace version placeholders with 1.95.0
(cherry picked from commit bad24ccbec)
2026-03-07 10:42:01 -08:00
Zalathar 7cb6912f46 Remove a flaky got_timeout assert from two channel tests
In CI, the receiver thread can be descheduled for a surprisingly long time, so
there's no guarantee that a timeout actually occurs.
2026-03-07 21:16:00 +11:00
Jonathan Brouwer 4e50a44530 Rollup merge of #153174 - Trivo25:fix-wasm64-sync-cfg, r=joboet
std: add wasm64 to sync::Once and thread_parking atomics cfg guards

When targeting `wasm64-unknown-unknown` with atomics enabled, `std::sync::Once` and `thread_parking` fall through to the `no_threads`/`unsupported` implementations because the cfg guards only check for `wasm32`. This causes worker threads to panic with `unreachable` at runtime. The underlying futex implementations already handle both wasm32 and wasm64 correctly, only the cfg guards were missing wasm64.

I tested this manually with a multithreaded wasm64 application ([o1js](https://github.com/o1-labs/o1js/)) compiled with `-Z build-std=panic_abort,std` and `-C target-feature=+atomics,+bulk-memory,+mutable-globals`

Related: rust-lang/rust#83879 rust-lang/rust#77839

Happy to adjust anything based on feedback
2026-03-06 18:49:47 +01:00
Florian 6a950e74b7 add wasm64 to sync::Once and thread_parking atomics cfg guard
Update library/std/src/sys/sync/once/mod.rs

Update library/std/src/sys/sync/thread_parking/mod.rs

Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2026-03-06 13:15:05 +03:00
joboet 6f980d4cbf std: use OnceLock for Xous environment variables 2026-03-05 19:59:15 +01:00
Jonathan Brouwer ed9d77216f Rollup merge of #153204 - xtqqczze:must-use-map, r=Amanieu,joboet
Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors

- `new_in`
- `with_capacity_and_hasher`
- `with_capacity_and_hasher_in`
- `with_hasher`
- `with_hasher_in`

See also: https://github.com/rust-lang/rust/issues/89692
2026-03-04 19:30:37 +01:00
Jonathan Brouwer 5ff104c0b2 Rollup merge of #153196 - MikkelPaulson:const-path-separators, r=joboet
Update path separators to be available in const context

Tracking issue: rust-lang/rust#153106

This makes platform-dependent secondary path separators available in const context (ie. at compile time). The platform definitions have also been consolidated behind a common macro to prevent transcription errors, whereas previously they were defined 3-4 times per platform.

### Questions

I've manually verified that this compiles against each platform. It seems like no unit tests should be required for this change; is that correct?
2026-03-04 19:30:37 +01:00
Jonathan Brouwer 1c44dbd580 Rollup merge of #152164 - mu001999-contrib:lint/unused_features, r=JonathanBrouwer
Lint unused features

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152164)*

Fixes rust-lang/rust#44232
Fixes rust-lang/rust#151752

---

This PR records used features through query side effect, then reports unsued features finally.
2026-03-04 19:30:36 +01:00
Mikkel Paulson 098b1b98f5 make path separators available in const context
* consolidate various representations of separators in std::sys::path
  into a single macro_rules invocation per platform to save
  transcription errors
* make `std::path::is_separator()` const
* new constants `std::path::{SEPARATORS, SEPARATORS_STR}`
2026-03-04 12:03:06 -05:00
joboet d31aecff6a std: reorganize some WASI helpers 2026-03-04 16:56:29 +01:00
joboet 866975f8a8 std: move SOLID error converting out of pal::os 2026-03-04 16:20:05 +01:00
joboet 390f683cfc std: move non-path functions into dedicated module in PAL 2026-03-04 16:20:05 +01:00
Mikkel Paulson 72de815eb2 reference local MAIN_SEPARATOR_STR
Change reference to imported MAIN_SEP_STR to local MAIN_SEPARATOR_STR,
removing an unnecessary import.
2026-03-04 10:01:43 -05:00
Matthias Krüger d70f5bdcca Rollup merge of #153341 - joboet:xous_params, r=tgross35
std: refactor Xous startup code

To facilitate rust-lang/rust#117276 I'm moving all non-path-related code out of `sys::pal::os` (see also rust-lang/rust#153130). This is particularly involved for Xous as `pal::os` also contains the `_start` entry function and the parameter block handling. This PR moves both out into the main `sys::pal` module and also simplifies the parameter block initialisation code slightly.

CC @xobs
2026-03-04 09:49:01 +01:00
Stuart Cook 49966fedd6 Rollup merge of #153295 - biscuitrescue:fix-panicking-docs, r=tgross35
update panicking() docs for panic=abort

fixes rust-lang/rust#151458

The documentation for `std::thread::panicking()` has not been changed since v1.0, even though panic hooks were added in v1.10.
Current documentation is misleading for `panic=abort`

`panicking()` can return `true` in 2 different cases:
1. Thread unwinds due to panic
2. Panic hook is executing with `panic=abort`

r? @SpriteOvO
2026-03-04 11:54:11 +11:00
Stuart Cook b5f3ca196a Rollup merge of #153272 - wmmc88:add-path-absolute-method, r=tgross35
Add `Path::absolute` method as alias for `std::path::absolute`

`Path::canonicalize()` is an alias for `fs::canonicalize()`, but there's no equivalent `Path::absolute()` for `path::absolute()`. This adds one.

Discussed in https://github.com/rust-lang/rust/issues/92750#issuecomment-2867636150, Chris [said](https://github.com/rust-lang/rust/issues/92750#issuecomment-2904002333) a PR would be welcome.

Tracking issue: rust-lang/rust#153328
2026-03-04 11:54:10 +11:00