Skip to content

Update subtree/library to 2026-08-21 - #686

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

Update subtree/library to 2026-08-21#686
github-actions[bot] wants to merge 1394 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 2026-02-05 (rust-lang/rust@db3e99b)
to 2026-08-21 (rust-lang/rust@8925ea3), inclusive.

Important

Do NOT use the GitHub "Merge pull request", "Squash and merge", or "Rebase and merge"
buttons on this PR.
subtree/library must stay a verbatim, linear mirror of upstream's
library/ directory, regenerated deterministically by splitsh-lite. Any web-UI merge
creates a synthetic commit that is not part of that extraction, which permanently diverges
the branch and makes every future subtree-update PR conflict (and the daily job then keeps
opening duplicate PRs).

To land this PR: review it as usual, and once approved push its commits literally to
subtree/library with no rebase and no merge:

git fetch origin update-subtree/library
git push origin origin/update-subtree/library:subtree/library

This PR will close automatically once its commits are on subtree/library.

devnexen and others added 30 commits August 5, 2026 10:23
The pages are demand-zero and never written, so the datagram test no
longer needs ~2 GiB of memory and its `#[ignore]` can go away. Keep a
`Vec`-backed copy for non-unix targets, where `mmap` isn't available.
…arksonn

std: fix stack buffer overflow in Windows junction_point

The guard checked `data_len > u16::MAX`, allowing paths far larger than `PathBuffer` (a fixed 16384-element array), which the subsequent single `copy_from` then overflows. Bound against `MAXIMUM_REPARSE_DATA_BUFFER_SIZE` plus header instead, matching the kernel's limit.
std: move futex implementations into sys::sync::futex

Part of rust-lang#117276.

Moves the futex primitives out of the per-platform `sys::pal` modules into a single `sys::sync::futex`, selected with `cfg_select!` the same way the other `sys::sync` backends are.
Every consumer of these primitives already lives in `sys::sync` (mutex, rwlock, once, condvar, thread_parking), so they now import `crate::sys::sync::futex` directly instead of reaching `crate::sys::futex` through the `pub use pal::*` glob.

I placed it under `sys::sync` rather than a top-level `sys::futex` because the futex API only backs the `sys::sync` primitives and sits next to the existing `sys::sync::thread_parking` backend.

Happy to place it to `sys::futex` if you would rather have it as a peer of the other feature modules.

The file moves are a separate commit, recorded in `.git-blame-ignore-revs` so blame skips the rename.

r? joboet
Emit thumb code on VEX V5

This PR switches the default codegen for the VEX V5 target to emit Thumb-2 instructions, allowing for smaller binary sizes (on the programs I tested this change on, I saw a ~20% size decrease on average). The target is renamed to have the `thumb` prefix instead of the `arm` prefix because of the updated instruction set.

Since VEXos starts all programs in Arm32 mode, the program entrypoint is explicitly compiled as ARM code and now transitions to Thumb mode when calling `_start`.

Users can still use the updated target in Arm32 mode by specifying `-Ctarget-feature=-thumb-mode`.

cc @tropicaaal @Gavin-Niederman
…athanBrouwer

Make the `rustc_unsafe_specialization_marker` attribute actually `unsafe`

Also renames it to `rustc_specialization_marker`.

The "some internal attributes should probably be unsafe" discussion came up in [#t-compiler/major changes > Implement a naming convention for lint/d… compiler-team#1021](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Implement.20a.20naming.20convention.20for.20lint.2Fd.E2.80.A6.20compiler-team.231021/with/612510054). This is one of those attributes.

cc @RalfJung
…tyle, r=jhpratt

Update expect messages in tcp.rs doc examples to follow the style guide

Related issue: rust-lang#159751

Rewords the `.expect(...)` messages in the `TcpStream`/`TcpListener` doc examples in `library/std/src/net/tcp.rs` to follow the "expect as precondition" style guide introduced in rust-lang#96033.

Examples of the change:
- `"set_nodelay call failed"` → `"set_nodelay should succeed"`
- `"could not set TTL"` → `"set_ttl should succeed"`
- `"Cannot set non-blocking"` → `"set_nonblocking should succeed"`

19 doc-example messages updated, all in doc comments (`///`). Doc-only change, no behavior change.
LLVM 21 preserves the bounds assumption but does not eliminate the aggregate phi that LLVM 22 removes. Check each version's supported optimization and restore the shared postcondition so direct callers can eliminate bounds checks.
…est, r=Urgau

[rustdoc] Do not take `doc(cfg())` into account when filtering doctests

Part of rust-lang#147033.

Because it was using the `extract_cfg_from_attrs` common function, it was taking into account the `doc(cfg())` attributes the same as if they were a `cfg`.

I didn't mark this PR as "fix" because I didn't handle the case of the doctest not being marked as ignored because I'm not sure if we should revisit the fact that we ignore these doctests or if we should just mark them as ignored (because of `target_feature(enable = "...")`).

Setting @fmease as reviewer as they are likely the only one with context about this issue. 😆

r? @fmease
…tch-1, r=nia-e

Reorder the methods in `#[rustc_must_implement_one_of]`

So that their order will be the preferred order for implementations (assuming implementing `read_buf()` is better), like @joshtriplett said in rust-lang#106643 (comment).

r? libs
This updates the rust-version file to f73951d.
Needed for the `__aeabi_u{read,write}*` symbols that we now require.
Cap socket send length to c_int::MAX on Apple targets

On Apple, `send`/`sendto` reject a length larger than `c_int::MAX` with `EINVAL` instead of doing a short send. The send length was only clamped to `wrlen_t::MAX` (a no-op on 64-bit unix), so writing more than `c_int::MAX` bytes to a socket failed on macOS.

Add a `MAX_SEND_LEN` cap (`c_int::MAX` on Apple, `wrlen_t::MAX` elsewhere), used in `write`, `send`, `send_to`, and `send_with_flags`.

Fixes rust-lang#115325
Account for desugaring in method call move errors

When encountering a move error caused by a desugared method call, talk about the user-facing feature (`await`/`?`/`for`-loop), instead of only the internal API it got desugared to.

```
error[E0382]: use of moved value: `entry`
  --> $DIR/moved-into-question-mark.rs:11:18
   |
LL |     for entry in fs::read_dir(".")? {
   |         ----- move occurs because `entry` has type `Result<DirEntry, std::io::Error>`, which does not implement the `Copy` trait
LL |
LL |         let file_type = entry?.file_type()?;
   |                         ------ `entry` moved due to usage in the question mark operator
...
LL |             dbg!(entry?.file_name());
   |                  ^^^^^ value used here after move
   |
note: the question mark operator is expanded into a call to `branch`, which takes ownership of the receiver `self`, which moves `entry`
  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
help: you could `clone` the value and consume it, if the following trait bounds could be satisfied: `DirEntry: Clone` and `std::io::Error: Clone`
   |
LL |         let file_type = entry.clone()?.file_type()?;
   |                              ++++++++
```

Fix rust-lang#89567.
Update error message in documentation comments

Fixes the `library/core/src/fmt/mod.rs` item in the rust-lang#159751 issue.
…from`

* Add support for wrapping of the return value of delegation
* Cleanups
* Review: use `make_lang_item_qpath`
Fixes the builds of rustc and library/std for the L4Re target OS.
A major change was done in linking binaries: The need for the L4Bender
tool was removed and linking parameters are now fully configured in the
rustc target config.
Pull in a patch that landed just recently but hasn't yet been
backported. Without it, symcheck fails.

Link: llvm/llvm-project#214465
Advance to after the first regression in `hypot` but before the second
regression. See [1] for context on `hypot`.

[1]: rust-lang/compiler-builtins#1249
they projected into a scalable vector, which hits assertions
okaneco and others added 29 commits August 17, 2026 14:59
Add function `nan_to` on floats which replaces NaN values with a
user-specified value or returns the original value if it is not a NaN.
…nathanBrouwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang#161221 (`rust-analyzer` subtree update)
 - rust-lang#161232 (Subtree sync for rustc_codegen_cranelift)
 - rust-lang#160058 (atomic volatile: add intrinsics)
 - rust-lang#161206 (Library lock file update)
 - rust-lang#160905 (implement <IpAddr, SocketAddr>::unspecified_from())
 - rust-lang#160986 (Move `LateParamRegion` to `rustc_type_ir`)
 - rust-lang#161145 (Remove references to the obsolete `try-perf` branch)
 - rust-lang#161197 (citool: update rust crates)
 - rust-lang#161225 (Add regression test for lint panic on nested generic with default type param)
 - rust-lang#161229 (rustc_target: couple AArch64 LLVM and cfg pauthtest ABIs)
 - rust-lang#161230 (rename `#[rustc_dump_predicates]` to `#[rustc_dump_clauses]`)
 - rust-lang#161237 (Remove jdno from infra-ci rotation)
This commit is an initial implementation of the `FnPtr` trait as
described in the `fn_static` tracking issue, which consists of moving
the internally unstable `core::marker::FnPtr` to `core::ops::FnPtr`, as
well as changing the API. Because `NonNull` is used in the new `as_ptr`
signature, it was also turned into a proper lang item.
…=workingjubilee

std: map ENOTSUP to ErrorKind::Unsupported

`ENOTSUP` and `EOPNOTSUPP` both mean the operation isn't supported. They're the same value on some targets (Linux, FreeBSD), where the existing `EOPNOTSUPP => Unsupported` arm (rust-lang#139822) already covers both, and different on others (Apple, OpenBSD), where `ENOTSUP` decodes to `Uncategorized` instead. I don't see a reason to treat it differently, so this maps `ENOTSUP` to `Unsupported` as well.

It uses a match guard rather than an or-pattern, since the two are equal on the targets where they alias and an or-pattern would be unreachable there. Same shape as the `EAGAIN`/`EWOULDBLOCK` arm just below:

```rust
x if x == libc::EOPNOTSUPP || x == libc::ENOTSUP => Unsupported,
```

This was raised once before (rust-lang#125228) and closed, since both errnos were left out of the original `Unsupported` PR (rust-lang#78880). rust-lang#139822 has since added `EOPNOTSUPP`, so the same reasoning now covers `ENOTSUP`.

I didn't add a test, since the decode arms aren't tested today.

r? libs
core/num: Implement feature `float_nan_to`

Accepted ACP: rust-lang/libs-team#787
Tracking issue: rust-lang#161248

Add function `nan_to` on `f16`, `f32`, `f64`, `f128` which replaces NaN values with a user-specified value or returns the original value if it is not a NaN.

---

No LLM use.
ref mut const unstable matching ref

vec, vecdeque: rename alloc to allocator

staticallocator on ref mut as well

wording will be the death of me

words order words random word words random good

eeeeeeeeeeeee

oh yeah these need the bound
…=jackh726

Initial implementation of `FnPtr` trait

This commit is an initial implementation of the `FnPtr` trait as described in the `fn_static` tracking issue, which consists of moving the internally unstable `core::marker::FnPtr` to `core::ops::FnPtr`, as well as changing the API. Because `NonNull` is used in the new `as_ptr` signature, it was also turned into a proper lang item.

Part of `fn_static`: rust-lang#148768
std: use UNIX's `Instant` and `SystemTime` on Hermit

Since rust-lang#154234 already shares UNIX's internal `Timespec` abstraction, `Instant` and `SystemTime` are just very thin wrappers over that. This shouldn't change any behaviour.

CC @stepancheg
CC @stlankes @mkroening
…ejrs

Adding diagnostic item markers for multiple fs functions and structs

A couple months ago there were a good number of TOCTOU/other filesystem lint issues created by @estebank in the clippy repo such as:

* [`Path::metdata` after `Path::exists`](rust-lang/rust-clippy#17158)
* [opening multiple files under a directory without using `open_at`](rust-lang/rust-clippy#17156)
* [File deletion followed by file creation](rust-lang/rust-clippy#17153)
* [File path comparison without canonicalizing](rust-lang/rust-clippy#17155)
* [File creation followed by setting permissions](rust-lang/rust-clippy#17154)

(There are more TOCTOU/filesystem bug lints that could be made aside from the list above, e.g. with symlinks).

I was particularly interested in working on the last issue on file creation followed by setting permissions. However, I don't think I could start working on it without diagnostic items on filesystem functions like `fs::set_permissions` or `fs::create_dir_all`. I decided to put diagnostic item attributes on all the filesystem functions and a couple of the structs because they may be useful in creating clippy lints against TOCTOU bugs or other relevant filesystem operation bugs.
…r=oli-obk

Remove fields from TypeKind: Struct, Enum, Union and Tuple

Tracking issue rust-lang#146922

r? @oli-obk
…nthey

Assorted allocator nitpicks

Small things that got missed in rust-lang#157428, doc language cleanup for allocator, and a rename that closes rust-lang#158344. cc @rust-lang/wg-allocators. pending libs bikeshed decision on the naming of `into_raw_parts_with_alloc`

r? clarfonthey
Doc: clarify how `Read::bytes` handling Interrupted errors

Fixes rust-lang#161288
(cherry picked from commit 982c768)
* doc: list all remove_dir_all fallback targets
* doc: restore original TOCTOU phrasing for remove_dir_all fallback list

Keep the expanded platform list but drop the writer-facing "uses the fallback
implementation" wording per review, restoring the original reason phrasing that
explains protection is absent because the underlying platform lacks the required
support.

Co-authored-by: Md Muhtasim Munif Fahim <s1911024120@ru.ac.bd>
…loc-reenter-3, r=nia-e

Ensure TLS accesses don't call the global allocator through panic (part 3)

Follow-up to rust-lang#160976

Missed TLS code that is in a completely different module for some reason

cc rust-lang#160930
…move-dir-all-docs, r=aapoalas

doc: list all remove_dir_all fallback targets

This adds the still-missing 
emove_dir_all fallback targets to the TOCTOU warning and updates the wording to describe the current implementation detail directly.

Closes rust-lang#153781
vec: fixup the name that i forgot

Forgot this in rust-lang#161115. per libs decision in rust-lang#158344
// SAFETY: initialized data never becoming uninitialized is an invariant of BorrowedBuf
buf: unsafe { &mut *(slice as *mut [u8] as *mut [MaybeUninit<u8>]) },
// SAFETY: no initialized element is ever uninitialized as per `BorrowedBuf`'s invariant
buf: unsafe { &mut *(slice as *mut [T] as *mut [MaybeUninit<T>]) },
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.