Skip to content

Update subtree/library to 2026-04-01 - #655

Open
github-actions[bot] wants to merge 691 commits into
subtree/libraryfrom
update-subtree/library
Open

Update subtree/library to 2026-04-01#655
github-actions[bot] wants to merge 691 commits into
subtree/libraryfrom
update-subtree/library

Conversation

@github-actions

Copy link
Copy Markdown

This is an automated PR to update the subtree/library branch to the changes from 2025-11-25 (rust-lang/rust@c871d09) to 2026-04-01 (rust-lang/rust@48cc71e), inclusive.
Review this PR as usual, but do not merge this PR using the GitHub web interface. Instead, once it is approved, use git push to literally push the changes to subtree/library without any rebase or merge.

sayantn and others added 30 commits March 5, 2026 18:27
…Amanieu

constify `Vec::{into, from}_raw_parts{_in|_alloc}`

due to Vec::drop not being const this is kinda necessary to make use of `const_heap`.
This reverts commit 30d7ed4.
It should not be needed any more.
We are now getting this warning:

    warning: the variable `j` is used as a loop counter
       --> libm/src/math/rem_pio2_large.rs:268:5
        |
    268 |     for i in 0..=m {
        |     ^^^^^^^^^^^^^^ help: consider using: `for (j, i) in ((jv as i32) - (jx as i32)..).zip((0..=m))`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop
        = note: `#[warn(clippy::explicit_counter_loop)]` on by default

    warning: `libm` (lib) generated 1 warning

Where the suggestion is definitely not an improvement.
These warnings are showing up on the most recent nightly:

    error: feature `f128` is declared but not used
     --> builtins-test/tests/addsub.rs:3:35
      |
    3 | #![cfg_attr(f128_enabled, feature(f128))]
      |                                   ^^^^

It isn't always easy to be more exact with the features we enable, so
mostly ignore this.
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>
Since we are starting to use the `fmaximum_num` intrinsics, LLVM may
emit these.
Correct const-stability attribute for avx512bw intrinsics
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#83879 rust-lang#77839

Happy to adjust anything based on feedback
…oss35

libcore float tests: replace macro shadowing by const-compatible macro

This lets us avoid rust-lang#153478.
However this means we generate 3 function items per assertion -- or rather, 3*8, since every assertion gets duplicated 8 times (4 float types, each in a const and a non-const variant). That's a lot; is it enough to be concerned about?
coretest already takes forever to build. In a quick test, build time increased from 29.8s to 30.8s, but that may also entirely be noise.

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

coretest in miri: fix using unstable libtest features

Alternative (IMO preferable) to rust-lang#153369. Also reverts that PR.
…Simulacrum

std: use `OnceLock` for Xous environment variables

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

CC @xobs
…ointee, r=Mark-Simulacrum

Update `UnsafeUnpin` impls involving extern types.

`UnsafeUnpin` tracking issue: rust-lang#125735

Relaxes from `T: ?Sized` (i.e. `T: MetaSized`) to `T: PointeeSized` for the `UnsafeUnpin` impls for pointers, references, and `PhantomData<T>`, and for the negative `UnsafeUnpin` impl for `UnsafePinned<T>`. (Compare to the impls for `Freeze` on lines 911-921.)

Both `UnsafeUnpin` and `extern type`s (the only way to have a `!MetaSized` type) are unstable, so this should have no effect on stable code.

Also updates the marker_impls macro docs to use PointeeSized bound, as most uses of the macro now do.

Concretely, this change means that the following types will newly implement `UnsafeUnpin`:

* pointers and references to `T` where `T` is an `extern type`
* `PhantomData<T>` where `T` is an extern type
* either of the above where `T` is a `struct` or tuple with `extern type` tail

Additionally, the negative `UnsafeUnpin` impl for `UnsafePinned<T>` is also relaxed to `T: PointeeSized` to align with the analogous negative `Freeze` impl for `UnsafeCell<T>`, even though both structs have `T: ?Sized` in their declaration (which probably should be relaxed, but that is a separate issue), so this part of the change doesn't actually *do* anything currently, but if `UnsafeCell` and `UnsafePinned` are later relaxed to `T: PointeeSized`, then the negative impl will apply to the newly possible instantiations. Also cc rust-lang#152645 that these impls compile at all.
…Simulacrum

num: Separate public API from internal implementations

Currently we have a single `core::num` module that contains both thin wrapper API and higher-complexity numeric routines. Restructure this by moving implementation details to a new `imp` module.

This results in a more clean separation of what is actually user-facing compared to items that have a stability attribute because they are public for testing.

The first commit does the actual change then the second moves a portion back.
Instead of generating a standalone executable to test `unicode_data`,
generate normal tests in `coretests`. This ensures tests are always
generated, and will be run as part of the normal testsuite.

Also change the generated tests to loop over lookup tables, rather than
generating a separate `assert_eq!()` statement for every codepoint. The
old approach produced a massive (20,000 lines plus) file which took
minutes to compile!
…Mark-Simulacrum

core: respect precision in `ByteStr` `Display`

Fixes rust-lang#153022.

`ByteStr`'s `Display` implementation didn't respect the precision parameter. Just like `Formatter::pad`, this is fixed by counting off the characters in the string and truncating after the requested length – with the added complication that the `ByteStr` needs to be divided into chunks first. By including a fast path that avoids counting the characters when no parameters were specified this should also fix the performance regressions caused by rust-lang#152865.
GuillaumeGomez and others added 27 commits March 29, 2026 00:06
…s, r=Mark-Simulacrum

`trim_prefix` for paths

under rust-lang#142312?

its a useful method.
#docs doesn't seem to exist anymore, so point people to `t-libs`.
Also include direct link to topic since Zulip is world-viewable now.
…-dead

Fix Vec::const_make_global for 0 capacity and ZST's

fixes rust-lang#153158
Don't fuse in `MapWindows`

cc rust-lang#87155

Fusing makes the iterator larger, slower, more complicated, and less useful. Users who need fusing behavior can always use `.fuse()`, but there is no way to get non-fusing behavior from the fused version.

@rustbot label A-iterators
…ottmcm

Constify comparisons and `Clone` for `core::mem::Alignment`

As suggested in rust-lang#153261 (comment)
…nTitor

Add doc links to `ExtractIf` of `BTree{Set,Map}` and `LinkedList`

There were links for `Hash{Set,Map}` and `Vec{,Deque}` versions, but not these three.
…inder`

Split the remainder functions from the rest of `std::range`.
…inder, r=scottmcm

core: Destabilize beta-stable `RangeInclusiveIter::remainder`



Destabilize `RangeInclusiveIter::remainder` and move `{RangeIter,RangefromIter}::remainder` to the `new_range_api` feature gate.

Original tracking issue: rust-lang#125687
New tracking issue: rust-lang#154458
Discussion: https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs-api.2Fapi-changes/topic/.60RangeFrom.3A.3Aremainder.60.20possible.20panic/with/582108913
…ulacrum

don't drop arguments' temporaries in `dbg!`

Fixes rust-lang#153850

Credit to @theemathas for help with macro engineering ^^

r? libs
…Simulacrum

feat: reimplement `hash_map!` macro

originally implemented in rust-lang#144070, this had to be reverted in rust-lang#148049 due to name ambiguity, as the macro was automatically put into the prelude. now, that rust-lang#139493 has landed, it is possible to have a top-level macro, that is not exported by default, which should make it possible to reland this again.

implements rust-lang#144032
implementation from rust-lang#144070, original author has been added as co-author
effectively reverts rust-lang#148049
Add `IoSplit` diagnostic item for `std::io::Split`

Similar to the existing `IoLines` item.  It will be used in Clippy to detect uses of `Split` leading to infinite loops similar to the existing lint for `Lines`.
…ulacrum

std_detect on AArch64 Darwin: Detect FEAT_SVE_B16B16

This is now exposed via `sysctl` as of macOS "Tahoe" 26.4 (or possibly earlier).
…l, r=Noratrieb

update zulip link in `std` documentation

#docs doesn't seem to exist anymore, so point people to `t-libs`. Also include direct link to topic since Zulip is world-viewable now.
Remove the `compiler-builtins` feature from default because it prevents
testing via the default `cargo test` command. It made more sense as a
default when `compiler-builtins` was a dependency that some crates added
via crates.io, but is no longer needed.

The `rustc-dep-of-std` feature is also removed since it doesn't do
anything beyond what the `compiler-builtins` feature already does.
stabilizes `core::range::Range`
stabilizes `core::range::RangeIter`
stabilizes `std::range` which was missed in prior PRs

Updates docs to reflect stabilization (removed "experimental")

`RangeIter::remainder` is excluded from stabilization
This create conflict if the timespec of a target has additional fields.
Use libc::timespec::default() instead
compiler-builtins: Clean up features

Remove the `compiler-builtins` feature from default because it prevents
testing via the default `cargo test` command. It made more sense as a
default when `compiler-builtins` was a dependency that some crates added
via crates.io, but is no longer needed.

The `rustc-dep-of-std` feature is also removed since it doesn't do
anything beyond what the `compiler-builtins` feature already does.
…gross35

stabilize new Range type and iterator

For rust-lang#125687
Stabilizes `core::range::Range` and `core::range::RangeIter`, newly stable API:

```rust
// in core::range

pub struct Range<Idx> {
    pub start: Idx,
    pub end: Idx,
}

impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> { /* ... */ }

impl<Idx: PartialOrd<Idx>> Range<Idx> {
    pub const fn contains<U>(&self, item: &U) -> bool
    where
        Idx: [const] PartialOrd<U>,
        U: ?Sized + [const] PartialOrd<Idx>;

    pub const fn is_empty(&self) -> bool
    where
        Idx: [const] PartialOrd;
}

impl<Idx: Step> Range<Idx> {
    pub fn iter(&self) -> RangeIter<Idx>;
}

impl<T> const RangeBounds<T> for Range<T> { /* ... */ }
impl<T> const RangeBounds<T> for Range<&T> { /* ... */ }

impl<T> const From<Range<T>> for legacy::Range<T> { /* ... */ }
impl<T> const From<legacy::Range<T>> for Range<T> { /* ... */ }

pub struct RangeIter<A>(/* ... */);

// `RangeIter::remainder` not stabilized

impl<A: Step> Iterator for RangeIter<A> {
    type Item = A;
    /* ... */
}

impl<A: Step> DoubleEndedIterator for RangeIter<A> { /* ... */ }
impl<A: Step> FusedIterator for RangeIter<A> { }
impl<A: Step> IntoIterator for Range<A> {
    type Item = A;
    type IntoIter = RangeIter<A>;
    /* ... */
}

impl ExactSizeIterator for RangeIter<u8> { }
impl ExactSizeIterator for RangeIter<i8> { }

unsafe impl<T> const SliceIndex<[T]> for range::Range<usize> {
    type Output = [T];
    /* ... */
}
unsafe impl const SliceIndex<str> for range::Range<usize> {
    type Output = str;
    /* ... */
}
```

Updates docs to reflect stabilization (removed "experimental")
…gross35

Update libc to v0.2.183

Follow-up of rust-lang#150484.
This PR updates libc to include the latest patches to make rtems target (and probably others) compile again.
…nathanBrouwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang#154419 (Take first task group for further execution)
 - rust-lang#154569 (Fix  type alias where clause suggestion spacing issue)
 - rust-lang#154617 (Update flate2 users to use zlib-rs)
 - rust-lang#154618 (Fix AtomicPtr::update's cfg gate)
 - rust-lang#154620 (stabilize new Range type and iterator)
 - rust-lang#151932 (refactor: remove `Adjust::ReborrowPin`)
 - rust-lang#153980 (refactor: move doc(rust_logo) check to parser)
 - rust-lang#154134 (fix: guard paren-sugar pretty-printing on short trait args)
 - rust-lang#154270 (Create `Ty` type alias in `rustc_type_ir`)
 - rust-lang#154580 (Split AttributeParserError Diagnostic implementation into subfunctions)
 - rust-lang#154606 (misc test cleanups)
 - rust-lang#154612 (Add a test for a now fixed ICE with `offset_of!()`)
…nathanBrouwer

Rollup of 4 pull requests

Successful merges:

 - rust-lang#150752 (Update libc to v0.2.183)
 - rust-lang#152432 (add rustc option -Zpacked-stack)
 - rust-lang#154634 (Use `Hcx`/`hcx` consistently for `StableHashingContext`.)
 - rust-lang#154635 (./x run miri: default to edition 2021)
@feliperodri
feliperodri enabled auto-merge (squash) August 25, 2026 14:57
@feliperodri feliperodri self-assigned this Aug 25, 2026
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.