Skip to content

Conversation

github-actions[bot]
Copy link

This is an automated PR to merge library subtree updates from 2025-08-26 (rust-lang/rust@54c5812) to 2025-09-09 (rust-lang/rust@9c27f27) (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: 83da666

sayantn and others added 30 commits August 17, 2025 19:34
previous code was perfectly sound because of MaybeUninit,
but it did waste cycles on copying memory that is
known to be uninitialized.
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 425a9c0
Filtered ref: 7e955d5a6c676a099595bdfaec0705d3703e7a3c

This merge was created using https://github.com/rust-lang/josh-sync.
Fix typo in doc for library/std/src/fs.rs#set_permissions

"privalage" -> "privilege".

Was reading the docs and have noticed this.
Implement the accepted ACP for methods that find the index of the least
significant (lowest) and most significant (highest) set bit in an
integer for signed, unsigned, and NonZero types.

Also add unit tests for all these types.
To avoid backwards compatibility problems.
compiler & tools dependencies:
     Locking 28 packages to latest compatible versions
    Updating anyhow v1.0.98 -> v1.0.99
    Updating bitflags v2.9.1 -> v2.9.2
    Updating clap v4.5.43 -> v4.5.45
    Updating clap_builder v4.5.43 -> v4.5.44
    Updating clap_derive v4.5.41 -> v4.5.45
    Updating curl v0.4.48 -> v0.4.49
    Updating curl-sys v0.4.82+curl-8.14.1 -> v0.4.83+curl-8.15.0
    Updating cxx v1.0.166 -> v1.0.168
    Updating cxx-build v1.0.166 -> v1.0.168
    Updating cxxbridge-cmd v1.0.166 -> v1.0.168
    Updating cxxbridge-flags v1.0.166 -> v1.0.168
    Updating cxxbridge-macro v1.0.166 -> v1.0.168
    Updating glob v0.3.2 -> v0.3.3
    Updating object v0.37.2 -> v0.37.3
    Updating proc-macro2 v1.0.95 -> v1.0.101
    Updating rayon v1.10.0 -> v1.11.0
    Updating rayon-core v1.12.1 -> v1.13.0
    Updating serde-untagged v0.1.7 -> v0.1.8
    Updating socket2 v0.5.10 -> v0.6.0
    Updating syn v2.0.104 -> v2.0.106
    Updating thiserror v2.0.12 -> v2.0.15
    Updating thiserror-impl v2.0.12 -> v2.0.15
    Updating uuid v1.17.0 -> v1.18.0
    Updating wasm-encoder v0.236.0 -> v0.236.1
    Updating wasmparser v0.236.0 -> v0.236.1
    Updating wast v236.0.0 -> v236.0.1
    Updating wat v1.236.0 -> v1.236.1
note: pass `--verbose` to see 35 unchanged dependencies behind latest

library dependencies:
     Locking 2 packages to latest compatible versions
    Updating libc v0.2.174 -> v0.2.175
    Updating object v0.37.2 -> v0.37.3
note: pass `--verbose` to see 2 unchanged dependencies behind latest

rustbook dependencies:
     Locking 13 packages to latest compatible versions
    Updating anyhow v1.0.98 -> v1.0.99
    Updating bitflags v2.9.1 -> v2.9.2
    Updating cc v1.2.32 -> v1.2.33
    Updating clap v4.5.43 -> v4.5.45
    Updating clap_builder v4.5.43 -> v4.5.44
    Updating clap_complete v4.5.56 -> v4.5.57
    Updating clap_derive v4.5.41 -> v4.5.45
    Updating proc-macro2 v1.0.95 -> v1.0.101
    Updating syn v2.0.104 -> v2.0.106
    Updating terminal_size v0.4.2 -> v0.4.3
    Updating thiserror v2.0.12 -> v2.0.15
    Updating thiserror-impl v2.0.12 -> v2.0.15
library: Migrate from `cfg_if` to `cfg_select`

Migrate the standard library from using the external `cfg_if` crate to using the now-built-in `cfg_select` macro.

This does not yet eliminate the dependency from `library/std/Cargo.toml`, because while the standard library itself no longer uses `cfg_if`, it also incorporates the `backtrace` crate, which does.

Migration assisted by the following vim command (after selecting the full `cfg_if!` invocation):

```
'<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e
```

This is imperfect, but substantially accelerated the process. This prompts for confirmation on the `} else {` since that can also appear inside one of the arms. This also requires manual intervention to handle any multi-line conditions.
Just like we implemented relatively complex rules to imply other extensions
**from** "C" (and some others), this commit implements implication
**to** the "C" extension from others, complying the following text
in the ISA Manual (although there's no direct imply/depend references).

> The C extension is the superset of the following extensions:
>
> - Zca
> - Zcf if F is specified (RV32 only)
> - Zcd if D is specified

This is formally verified so that no other extension combinations
(*not* in this implementation) can (currently) imply the "C" extension.
…h, r=Amanieu

`impl PartialEq<{str,String}> for {Path,PathBuf}`

This is a revival of rust-lang#105877

Comparison of paths and strings is expected to be possible and needed e.g. in tests. This change adds the impls os `PartialEq` between strings and paths, both owned and unsized, in both directions.

ACP: rust-lang/libs-team#151
Stabilize `ip_from`

Tracking issue: rust-lang#131360

Stabilizes and const-stabilizes the following APIs:
```rust
// core::net
impl Ipv4Addr {
    pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr;
}
impl Ipv6Addr {
    pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr;
    pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr;
}
```

Closes rust-lang#131360

```@rustbot``` label +needs-fcp
…spose, r=ibraheemdev

Trivial improve doc for transpose

When I saw old doc, I felt a little confused.
Seems it would be clearer this way.
…_sleep_tests_on_sgx, r=Mark-Simulacrum

[RTE-513] Ignore sleep_until test on SGX

rust-lang#141829 added a test for `sleep_until`: it checks whether its specification holds:
> Puts the current thread to sleep until the specified deadline has passed.

but in SGX there's no secure time source. There's only the ability to request the `insecure_time` from outside of the enclave through a [usercall](https://github.com/fortanix/rust-sgx/blob/master/intel-sgx/fortanix-sgx-abi/src/lib.rs#L590-L592) and the ability to [wait](https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/sgx/abi/usercalls/mod.rs#L173-L179) for a certain event or timeout. But both are under the control of an attacker; users should not depend on the accuracy nor correctness of this time. We try to even enforce this by adding a +/-10% time interval to wait usercalls.

The current `thread::sleep_until` implementation uses this `wait` usercall. When a negative randomization interval is added to the timeout passed in `wait`, the test fails. As users should not rely on the correctness of any time inside the enclave, it should be considered an incorrect test on SGX. This PR ignores this test.
…=petrochenkov

Remove the `From` derive macro from prelude

The new `#[derive(From)]` functionality (implemented in rust-lang#144922) caused name resolution ambiguity issues (rust-lang#145524). The reproducer looks e.g. like this:

```rust
mod foo {
    pub use derive_more::From;
}

use foo::*;

#[derive(From)] // ERROR: `From` is ambiguous
struct S(u32);
```

It's pretty unfortunate that it works like this, but I guess that there's not much to be done here, and we'll have to wait for the next edition to put the `From` macro into the prelude. That will probably require rust-lang#139493 to land.

I created a new module in core (and re-exported it in std) called `from`, where I re-exported the `From` macro. I *think* that since this is a new module, it should not have the same backwards incompatibility issue.

Happy to hear suggestions about the naming - maybe it would make sense as `core::macros::from::From`? But we already had a precedent in the `core::assert_matches` module, so I just followed suit.

Fixes: rust-lang#145524

r? ``@petrochenkov``
…ofollow, r=ibraheemdev

implement std::fs::set_permissions_nofollow on unix

implementation of rust-lang#141607
…oss35

fmt of non-decimal radix untangled

Have the implementation match its decimal counterpart.

* Digit table instead of conversion functions
* Correct buffer size per radix
* Elimination of dead code for negative
* No trait abstraction for integers

#### Original Performance
```
    fmt::write_10ints_bin                                                393.03ns/iter      +/- 1.41
    fmt::write_10ints_hex                                                316.84ns/iter      +/- 1.49
    fmt::write_10ints_oct                                                327.16ns/iter      +/- 0.46
```

#### Patched Performance
```
    fmt::write_10ints_bin                                                392.31ns/iter      +/- 3.05
    fmt::write_10ints_hex                                                302.41ns/iter      +/- 5.48
    fmt::write_10ints_oct                                                322.01ns/iter      +/- 3.82
```

r? tgross35
Correct some grammar in integer documentation

Update "between" to "among" (more than two items), connect the "which" dependent clause to the independent part, and remove the redundant "here".
…=Kobzol

run spellcheck as a tidy extra check in ci

This is probably how it should've been done from the start.

r? ``@Kobzol``
rustc_target: Add the `32s` target feature for LoongArch

LLVM: llvm/llvm-project#139695
…emdev

dec2flt: Provide more valid inputs examples

I was just looking at the specifics of how the parsing is handled here and I wasn't sure if the examples were incomplete or the grammar below was misleading.

The grammar was correct so I figured I'd add these examples to clarify.
…heemdev

Hide docs for `core::unicode`

This module is perma-unstable and shouldn't show up in the public docs. If people want to see the docs for it, they can still run `RUSTDOCFLAGS=--document-hidden-items ./x doc library/core`.
…string_new, r=ibraheemdev

Stabilize `const_pathbuf_osstring_new` feature

This closes [tracking issue](rust-lang#141520) and stabilises `{OsString, PathBuf}::new` in const
…riplett

Rust build fails on OpenBSD after using file_lock feature

PR 130999 added the file_lock feature, but doesn't included OpenBSD in the supported targets (Tier 3 platform), leading to a compilation error ("try_lock() not supported").

Cc `@cberner`

Related to rust-lang#130999
…backshift-less, r=tgross35

bufreader::Buffer::backshift: don't move the uninit bytes

previous code was perfectly sound because of MaybeUninit, but it did waste cycles on copying memory that is known to be uninitialized.
Use deref coercion to let the compiler remove any amount of references.
tgross35 and others added 20 commits September 5, 2025 20:10
…tgross35

std: Update `wasi` crate dependency

The recent work on the WASIp2 target being integrated into the standard library (rust-lang#146207, rust-lang#145944) ended up causing a bug in nightly on the target. This [has now been fixed](bytecodealliance/wasi-rs#115) in the `wasi` crate so this commit pulls in the updated version to ensure bindings work correctly.
clean up some old const trait impl syntax

Related to: rust-lang#143874
…oss35

Add socket extensions for cygwin

r? `@joboet`

* Abstract name uds addr
* quickack
* passcred
single buffer for exponent fmt of integers

No need for fragmented buffers when formatting.

```
orig.txt: fmt::write_i128_exp                                                  143.39ns/iter      +/- 0.32
orig.txt: fmt::write_i64_exp                                                    68.72ns/iter      +/- 0.03
new.txt:  fmt::write_i128_exp                                                  138.29ns/iter      +/- 0.50
new.txt:  fmt::write_i64_exp                                                    58.93ns/iter      +/- 4.62
```

This patch fully eliminates unsafe pointer use (after rust-lang#135265 and rust-lang#136594).

    r? libs
…oreign-items-take2, r=RalfJung

Miri: non-deterministic floating point operations in foreign_items

Take 2 of rust-lang#143906. The last 2 commits are what changed compared to the original pr.

Verified the tests using (fish shell):
```fish
env MIRIFLAGS="-Zmiri-max-extra-rounding-error -Zmiri-many-seeds" ./x miri --no-fail-fast std core coretests  -- f32 f64
```

r? `@RalfJung`
The ASCII subset of Unicode is fixed and will never change, so we don't
need to generate tables for it with every new Unicode version. This
saves a few bytes of static data and speeds up `char::is_control` and
`char::is_grapheme_extended` on ASCII inputs.

Since the table lookup functions exported from the `unicode` module will
give nonsensical errors on ASCII input (and in fact will panic in debug
mode), I had to add some private wrapper methods to `char` which check
for ASCII-ness first.
…mulacrum

feat(std): emulate flock for solaris via fcntl

Upstream Solaris flock emulation to libstd from cargo.

This is borrowed from
https://github.com/rust-lang/cargo/blob/3b379fcc541b39321a7758552d37e5e0cc4277b9/src/cargo/util/flock.rs#L502-L536 which was implemented by an Oracle employee.
The code has been in cargo since 2022-12.

Python's `fcntl.flock` emulates like this as well: https://github.com/python/cpython/blob/c919d02edecfe9d75fe374756fb8aa1db8d95f55/Modules/fcntlmodule.c#L337-L400

We did the same thing in
https://github.com/rust-lang/rust/blob/0d0f4eac8b98133e5da6d3604d86a8f3b5a67844/compiler/rustc_data_structures/src/flock/unix.rs#L13-L39

However, should we just always falls back to fcntl for all Unix, instead of "unsupported"?

try-job: `*-solaris`
…jhpratt

Don't include ASCII characters in Unicode tables

Split off from rust-lang#145219
…lize-docs, r=jhpratt

docs(std): add error docs for path canonicalize

This PR adds the missing error documentation for both [Path.canonicalize](https://doc.rust-lang.org/std/path/struct.Path.html#method.canonicalize) and [PathBuf.canonicalize](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.canonicalize) methods. Since both methods are wappers around [fs::canonicalize](https://doc.rust-lang.org/std/fs/fn.canonicalize.html), the error doc is copied directly from that function.

This makes it faster to find what errors might arise when calling `path.canonicalize` or `path_buf.canonicalize` in the editor itself without needing to drill down to the  `fs::canonicalzie` docs.
Fix typo in default.rs

This sentence currently reads:

> Rust implements `Default` for various primitives types.

I think it should just be "primitive types".
@github-actions github-actions bot requested a review from a team as a code owner September 10, 2025 14:14
@tautschnig tautschnig closed this Sep 10, 2025
@tautschnig tautschnig reopened this Sep 10, 2025
@btj
Copy link

btj commented Sep 10, 2025

#489 , which targets this branch, syncs the VeriFast proofs.

Updates the VeriFast proofs

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
@tautschnig
Copy link
Member

We need to investigate proof failure of time::Duration::from_nanos_u128.

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.