Skip to content

Merge subtree update for toolchain nightly-2025-05-22 #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10,000 commits into from
May 28, 2025
Merged

Conversation

github-actions[bot]
Copy link

This is an automated PR to merge library subtree updates from 2025-05-20 (rust-lang/rust@60dabef) to 2025-05-22 (rust-lang/rust@bf64d66) (inclusive) into main. git merge resulted in conflicts, which require manual resolution. Files were commited with merge conflict markers. Do not remove or edit the following annotations:
git-subtree-dir: library
git-subtree-split: 02d9329

Natural-selection1 and others added 30 commits April 24, 2025 10:22
…jhpratt

Stabilize the `cell_update` feature

Included API:

```rust
impl<T: Copy> Cell<T> {
    pub fn update(&self, f: impl FnOnce(T) -> T);
}
```

FCP completed once at rust-lang#50186 (comment) but the signature has since changed.

Closes: rust-lang#50186
std: Add performance warnings to HashMap::get_disjoint_mut

Closes rust-lang#139296

The `get_disjoint_mut` in `HashMap` also performs a complexity O(n^2) check. So we need to be reminded of that as well.

https://github.com/rust-lang/hashbrown/blob/b5b0655a37e156f9798ac8dd7e970d4adba9bf90/src/raw/mod.rs#L1216-L1220
…ss35

Impl new API `std::os::unix::fs::mkfifo` under feature `unix_fifo`

Tracking issue rust-lang#139324
… r=SparrowLii

Remove unnecessary clones

r? `@SparrowLii`
Mention average in midpoint documentations

Added a mention to "average" in midpoint documentations and as well as some `#[doc(alias = "average")]`[^1].

This is done to improve the discoverability of the function.

[^1]: https://docs.rs/num-integer/latest/num_integer/trait.Average.html#tymethod.average_floor
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139261 (mitigate MSVC alignment issue on x86-32)
 - rust-lang#140075 (Mention average in midpoint documentations)
 - rust-lang#140184 (Update doc of cygwin target)
 - rust-lang#140186 (Rename `compute_x` methods)
 - rust-lang#140194 (minicore: Have `//@ add-core-stubs` also imply `-Cforce-unwind-tables=yes`)
 - rust-lang#140195 (triagebot: label minicore changes w/ `A-test-infra-minicore` and ping jieyouxu on changes)
 - rust-lang#140214 (Remove comment about handling non-global where bounds with corresponding projection)
 - rust-lang#140228 (Revert overzealous parse recovery for single colons in paths)

r? `@ghost`
`@rustbot` modify labels: rollup
Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc

implements rust-lang#136067

Rust has helper methods for many kinds of safe transmutes, for example integer<->bytes. This is a lint against using transmute for these cases.

```rs
fn bytes_at_home(x: [u8; 4]) -> u32 {
   transmute(x)
}

// other examples
transmute::<[u8; 2], u16>();
transmute::<[u8; 8], f64>();
transmute::<u32, [u8; 4]>();
transmute::<char, u32>();
transmute::<u32, char>();
```
It would be handy to suggest `u32::from_ne_bytes(x)`.
This is implemented for `[u8; _]` -> `{float int}`

This also implements the cases:
`fXX` <-> `uXX` = `{from_bits, to_bits}`
`uXX` -> `iXX` via `cast_unsigned` and `cast_signed`
{`char` -> `u32`, `bool` -> `n8`} via `from`
`u32` -> `char` via `from_u32_unchecked` (note: notes `from_u32().unwrap()`) (contested)
`u8` -> `bool` via `==` (debatable)

---
try-job: aarch64-gnu
try-job: test-various
Move zkVM constants into `sys::env_consts`

I missed this in rust-lang#139868. Its `mod` declaration was removed, but the contents were not moved.

r? joboet
fix MAX_EXP and MIN_EXP docs

As pointed out in rust-lang#88734, the docs for these constants are wrong.

r? ``@tgross35``
…r=RalfJung

Make algebraic functions into `const fn` items.

Tracking issue: rust-lang#136469

This PR makes the algebraic intrinsics and the unstable, algebraic functions of `f16`, `f32`, `f64`, and `f128` into `const fn` items:

```rust
impl f16 {
    pub const fn algebraic_add(self, rhs: f16) -> f16;
    pub const fn algebraic_sub(self, rhs: f16) -> f16;
    pub const fn algebraic_mul(self, rhs: f16) -> f16;
    pub const fn algebraic_div(self, rhs: f16) -> f16;
    pub const fn algebraic_rem(self, rhs: f16) -> f16;
}

impl f32 {
    pub const fn algebraic_add(self, rhs: f32) -> f32;
    pub const fn algebraic_sub(self, rhs: f32) -> f32;
    pub const fn algebraic_mul(self, rhs: f32) -> f32;
    pub const fn algebraic_div(self, rhs: f32) -> f32;
    pub const fn algebraic_rem(self, rhs: f32) -> f32;
}

impl f64 {
    pub const fn algebraic_add(self, rhs: f64) -> f64;
    pub const fn algebraic_sub(self, rhs: f64) -> f64;
    pub const fn algebraic_mul(self, rhs: f64) -> f64;
    pub const fn algebraic_div(self, rhs: f64) -> f64;
    pub const fn algebraic_rem(self, rhs: f64) -> f64;
}

impl f128 {
    pub const fn algebraic_add(self, rhs: f128) -> f128;
    pub const fn algebraic_sub(self, rhs: f128) -> f128;
    pub const fn algebraic_mul(self, rhs: f128) -> f128;
    pub const fn algebraic_div(self, rhs: f128) -> f128;
    pub const fn algebraic_rem(self, rhs: f128) -> f128;
}

// core::intrinsics

pub const fn fadd_algebraic<T: Copy>(a: T, b: T) -> T;
pub const fn fsub_algebraic<T: Copy>(a: T, b: T) -> T;
pub const fn fmul_algebraic<T: Copy>(a: T, b: T) -> T;
pub const fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T;
pub const fn frem_algebraic<T: Copy>(a: T, b: T) -> T;
```

This PR does not preserve the initial behaviour of these functions yielding non-deterministic output under Miri; it is most likely desired to reimplement this behaviour at some point.
`concat_idents` has been around unstably for a long time, but there is
now a better (but still unstable) way to join identifiers using
`${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves
a lot of the problems with `concat_idents` and is on a better track
toward stabilization, so there is no need to keep both versions around.
`concat_idents!` still has a lot of use in the ecosystem so deprecate it
before removing, as discussed in [1].

Link: rust-lang#124225
[1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
Work around cygwin issue on condvar timeout

This workaround *just works*... Actually I don't quite understand why does it work in such way. With a simple test on Cygwin, it seems that the maximum value of `tv_sec` could be 12899331056917, while the maximum value of `tv_nsec` should be a value floating around 464600000. A larger `timespec` could block the syscall forever.

r? `@joboet`
…r=workingjubilee

Deprecate the unstable `concat_idents!`

`concat_idents` has been around unstably for a long time, but there is now a better (but still unstable) way to join identifiers using `${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves a lot of the problems with `concat_idents` and is on a better track toward stabilization, so there is no need to keep both versions around. `concat_idents!` still has a lot of use in the ecosystem so deprecate it before removing, as discussed in [1].

Link: rust-lang#124225

[1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
…oc, r=Amanieu

Update the index of Option to make the summary more comprehensive

fix: rust-lang#138955

This PR and rust-lang#138968 are twin PR

By the way, this is my first time contributing to rust, and I'm not a native English speaker, so any suggestions—whether about the wording in the docs or the contribution process itself—would be greatly appreciated!
Move `sys::pal::os::Env` into `sys::env`

Although `Env` (as `Vars`), `Args`, path functions, and OS constants are publicly exposed via `std::env`, their implementations are each self-contained. Keep them separate in `std::sys` and make a new module, `sys::env`, for `Env`.

Also fix `unsafe_op_in_unsafe_fn` for Unix and update the `!DynSend` and `!DynSync` impls which had grown out of sync with the platforms (see rust-lang#48005 for discussion on that).

r? joboet

Tracked in rust-lang#117276.
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#137096 (Stabilize flags for doctest cross compilation)
 - rust-lang#140148 (CI: use aws codebuild for job dist-arm-linux)
 - rust-lang#140187 ([AIX] Handle AIX dynamic library extensions within c-link-to-rust-dylib run-make test)
 - rust-lang#140196 (Improved diagnostics for non-primitive cast on non-primitive types (`Arc`, `Option`))
 - rust-lang#140210 (Work around cygwin issue on condvar timeout)
 - rust-lang#140213 (mention about `x.py setup` in `INSTALL.md`)
 - rust-lang#140229 (`DelimArgs` tweaks)
 - rust-lang#140248 (Fix impl block items indent)

r? `@ghost`
`@rustbot` modify labels: rollup
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#137653 (Deprecate the unstable `concat_idents!`)
 - rust-lang#138957 (Update the index of Option to make the summary more comprehensive)
 - rust-lang#140006 (ensure compiler existance of tools on the dist step)
 - rust-lang#140143 (Move `sys::pal::os::Env` into `sys::env`)
 - rust-lang#140202 (Make #![feature(let_chains)] bootstrap conditional in compiler/)
 - rust-lang#140236 (norm nested aliases before evaluating the parent goal)
 - rust-lang#140257 (Some drive-by housecleaning in `rustc_borrowck`)
 - rust-lang#140278 (Don't use item name to look up associated item from trait item)

r? `@ghost`
`@rustbot` modify labels: rollup
…oc, r=Amanieu

Update the index of Result to make the summary more comprehensive

fix rust-lang#138966

This PR and rust-lang#138957 are twin PR

r? `@Amanieu`
…t-blocks-in-const-keyword-doc-page, r=tgross35

docs(std): mention const blocks in const keyword doc page

Aims to close rust-lang#139549
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#137683 (Add a tidy check for GCC submodule version)
 - rust-lang#138968 (Update the index of Result to make the summary more comprehensive)
 - rust-lang#139572 (docs(std): mention const blocks in const keyword doc page)
 - rust-lang#140152 (Unify the format of rustc cli flags)
 - rust-lang#140193 (fix ICE in `#[naked]` attribute validation)
 - rust-lang#140205 (Tidying up UI tests [2/N])
 - rust-lang#140284 (remove expect() in `unnecessary_transmutes`)
 - rust-lang#140290 (rustdoc: fix typo change from equivelent to equivalent)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar and others added 16 commits May 20, 2025 12:53
Replace `try_reserve_exact` with `try_with_capacity` in `std::fs::read`

This change restores the previous behavior prior to rust-lang#117925. That PR was made to handle OOM errors that turn into a panic with `Vec::with_capacity`. `try_reserve_exact` was used for that since there was no `try_with_capacity` method at the time. It was added later in rust-lang#120504. I think it'd a better fit here.
When these functions were added in
rust-lang#138087
It made a relatively common pattern for emulating
these functions using an extension trait (which
internally uses `libm`) much more fragile.
If `core::f32` happened to be imported by the user
(to access a constant, say), then that import in
the module namespace would take precedence over
`f32` in the type namespace for resolving these
functions, running headfirst into the stability
attribute.

We ran into this in Color -
https://github.com/linebender/color - and chose to
release the remedial 0.3.1 and 0.2.4, to allow
downstream crates to build on `docs.rs`.
As these methods are perma-unstable, moving them
into a new module should not have any long-term
concerns, and ensures that this breakage doesn't
adversely impact anyone else.
…hild process

This adds a `chroot` method to the `CommandExt` extension trait for the
`Command` builder, to set a directory to chroot into. This will chroot
the child process into that directory right before calling chdir for the
`Command`'s working directory.

To avoid allowing a process to have a working directory outside of the
chroot, if the `Command` does not yet have a working directory set,
`chroot` will set its working directory to "/".
…ross35

`core_float_math`: Move functions to `math` module

When these functions were added in rust-lang#138087 It made a relatively common pattern for emulating these functions using an extension trait (which internally uses `libm`) much more fragile. If `core::f32` happened to be imported by the user (to access a constant, say), then that import in the module namespace would take precedence over the `f32` in the type namespace for resolving these functions, running headfirst into the stability attribute.

We ran into this in [Color](https://github.com/linebender/color) and chose to release the remedial 0.3.1 and 0.2.4, to allow downstream crates to build on `docs.rs`.

As these methods are perma-unstable, moving them into a new module should not have any long-term concerns, and ensures that this "breakage" doesn't adversely impact anyone else.

I believe that I've made the module unstable correctly. I presume that this does not require a test to make sure stable code can't depend on the module existing?

I've left the stability attribute on each function - happy to tweak this if a different pattern is more correct.

Tracking issue for `core_float_math`: rust-lang#137578.
This PR is as requested in rust-lang#138087.

r? `@tgross35`

Recommended reviewing with whitespace hidden.

(This is my first PR to `std/core`/this repository, as far as I can remember)
use `Self` alias in self types rather than manually substituting it

Of the rougly 145 uses of `self: Ty` in the standard library, 5 of them don't use `Self` but instead choose to manually "substitute" the `impl`'s self type into the type.

This leads to weird behavior sometimes (rust-lang#140611 (comment)) -- **to be clear**, none of these usages actually trigger any bugs, but it's possible that they may break in the future (or at least lead to lints), so let's just "fix" them proactively.
Link `Command::current_dir`.

Co-authored-by: Amanieu d'Antras <[email protected]>
…ross35

Implement `ptr::try_cast_aligned` and `NonNull::try_cast_aligned`.

Implement three common methods on raw pointers and `NonNull`s: `try_cast_aligned`.

## Related links

- Tracking Issue: rust-lang#141221

## About `#[inline]`

Since the result of a call to `align_of` is a power of two known at compile time, the compiler is able to reduce a call to `try_cast_aligned` to only test and sete (or test and jne if followed by `unwrap`), at least on every tier 1 target's arch. This seemed like a good reason to `#[inline]` the function.

- https://godbolt.org/z/ocehvPWMx (raw inlining)
- https://godbolt.org/z/3qa4j4Yrn (comparison with no inlining)
…nieu

Add `std::os::unix::process::CommandExt::chroot` to safely chroot a child process

This adds a `chroot` method to the `CommandExt` extension trait for the
`Command` builder, to set a directory to chroot into. This will chroot
the child process into that directory right before calling chdir for the
`Command`'s working directory.

To avoid allowing a process to have a working directory outside of the
chroot, if the `Command` does not yet have a working directory set,
`chroot` will set its working directory to "/".

---

ACP: rust-lang/libs-team#551

This PR currently has the tracking issue set to "none"; if the ACP is approved,
I'll file a tracking issue and update the PR.
@github-actions github-actions bot requested a review from a team as a code owner May 23, 2025 14:10
@carolynzech carolynzech enabled auto-merge May 28, 2025 14:42
@carolynzech carolynzech added this pull request to the merge queue May 28, 2025
Merged via the queue into main with commit b4f59e8 May 28, 2025
47 of 48 checks passed
@carolynzech carolynzech deleted the sync-2025-05-22 branch May 28, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.