forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 57
Merge subtree update for toolchain nightly-2025-08-06 #447
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ieu,tgross35 slice: Mark `rotate_left`, `rotate_right` unstably const Tracking issue rust-lang#143812 - Add the const unstable `const_slice_rotate` feature - Mark `<[T]>::rotate_left` and `<[T]>::rotate_right` as const unstable The internal rotate functions use [`<*mut T>::replace`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.replace) and [`ptr::swap_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/fn.swap_nonoverlapping.html) which were const-stabilized in 1.88. Two changes were needed in the `rotate.rs` module to make these functions const: 1. A usage of `cmp::min` was replaced with a local function implementation of [`Ord::min`](https://doc.rust-lang.org/1.88.0/src/core/cmp.rs.html#1048-1053). 2. A `for start in 1..gcd` loop was changed to a while loop with an increment variable. This needs libs-api approval and cc-ing const-eval.
constify `From` and `Into` tracking issue rust-lang#143773 r? ``````@fee1-dead`````` I did not mark any impls elsewhere as `const`, those can happen on their own timeframe and don't need to be part of this MVP. But if there are some core ones you think should be in there I'll happily add them, just couldn't think of any
… r=petrochenkov make `cfg_select` a builtin macro tracking issue: rust-lang#115585 This parses mostly the same as the `macro cfg_select` version, except: 1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected. 2. in an expression context, the rhs is no longer wrapped in a block, so that this now works: ```rust fn main() { println!(cfg_select! { unix => { "foo" } _ => { "bar" } }); } ``` 3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule. cc `@traviscross` if I'm missing any feature that should/should not be included r? `@petrochenkov` for the macro logic details
This PR adds `#[inline]` to the method `str::split_at_unchecked()`. This is done for two reasons: 1. The method is tiny, e.g. on AMD-64 (<https://godbolt.org/z/ba68fdfxn>): ```asm movq %rdi, %rax subq %rcx, %rdx movq %rsi, (%rdi) addq %rcx, %rsi movq %rcx, 8(%rdi) movq %rsi, 16(%rdi) movq %rdx, 24(%rdi) retq ``` 2. More importantly, inlining the method enables further automatic optimizations. E.g. if you split at index 3, then in the compiler (rustc, llvm or both) knows that this code cannot fail, and the panicking path is omitted in the generated code: ```rust pub fn punctuation(i: &str) -> Result<(), ()> { const THREE_CHARS: &[[u8; 3]] = &[*b"<<=", *b">>=", *b"...", *b"..="]; if let Some((head, _)) = i.split_at_checked(3) && THREE_CHARS.contains(&head.as_bytes().try_into().unwrap()) { Ok(()) } else { Err(()) } } ``` <details> <summary>Without PR</summary> <https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=0234de8158f467eebd73286f20d6e27a> ```asm playground::punctuation: subq $40, %rsp movq %rsi, %rdx movq %rdi, %rsi movb $1, %al cmpq $3, %rdx ja .LBB2_2 je .LBB2_3 .LBB2_11: addq $40, %rsp retq .LBB2_2: cmpb $-64, 3(%rsi) jl .LBB2_11 .LBB2_3: leaq 8(%rsp), %rdi movl $3, %ecx callq *core::str::<impl str>::split_at_unchecked@GOTPCREL(%rip) movq 8(%rsp), %rcx movb $1, %al testq %rcx, %rcx je .LBB2_11 cmpq $3, 16(%rsp) jne .LBB2_12 movzwl (%rcx), %edx movzbl 2(%rcx), %ecx shll $16, %ecx orl %edx, %ecx cmpl $4013115, %ecx jg .LBB2_8 cmpl $3026478, %ecx je .LBB2_10 cmpl $4009518, %ecx je .LBB2_10 jmp .LBB2_11 .LBB2_8: cmpl $4013630, %ecx je .LBB2_10 cmpl $4013116, %ecx jne .LBB2_11 .LBB2_10: xorl %eax, %eax addq $40, %rsp retq .LBB2_12: leaq .Lanon.d98a7fbb86d10a97c24516e267466134.2(%rip), %rdi leaq .Lanon.d98a7fbb86d10a97c24516e267466134.1(%rip), %rcx leaq .Lanon.d98a7fbb86d10a97c24516e267466134.6(%rip), %r8 leaq 7(%rsp), %rdx movl $43, %esi callq *core::result::unwrap_failed@GOTPCREL(%rip) ``` </details> <details> <summary>With PR</summary> <https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=5d4058c79ce0f6cb1a434190427d2055> ```asm playground::punctuation: movb $1, %al cmpq $3, %rsi ja .LBB0_2 je .LBB0_3 .LBB0_9: retq .LBB0_2: cmpb $-64, 3(%rdi) jl .LBB0_9 .LBB0_3: movzwl (%rdi), %eax movzbl 2(%rdi), %ecx shll $16, %ecx orl %eax, %ecx movb $1, %al cmpl $4013115, %ecx jg .LBB0_6 cmpl $3026478, %ecx je .LBB0_8 cmpl $4009518, %ecx je .LBB0_8 jmp .LBB0_9 .LBB0_6: cmpl $4013630, %ecx je .LBB0_8 cmpl $4013116, %ecx jne .LBB0_9 .LBB0_8: xorl %eax, %eax retq ``` </details>
These seem like they were missed in <rust-lang#141224>
…t, r=compiler-errors update issue number for `const_trait_impl` r? project-const-traits cc rust-lang#67792 rust-lang#143874
Use zero for initialized Once state By re-labeling which integer represents which internal state for `Once` we can ensure that the initialized state is the all-zero state. This is beneficial because some CPU architectures (such as Arm) have specialized instructions to specifically branch on non-zero, and checking for the initialized state is by far the most important operation. As an example, take this: ```rust use std::sync::atomic::{AtomicU32, Ordering}; const INIT: u32 = 3; #[inline(never)] #[cold] pub fn slow(state: &AtomicU32) { state.store(INIT, Ordering::Release); } pub fn ensure_init(state: &AtomicU32) { if state.load(Ordering::Acquire) != INIT { slow(state) } } ``` If `INIT` is 3 (as is currently the state for `Once`), we see the following assembly on `aarch64-apple-darwin`: ```asm example::ensure_init::h332061368366e313: ldapr w8, [x0] cmp w8, #3 b.ne LBB1_2 ret LBB1_2: b example::slow::ha042bd6a4f33724e ``` By changing the `INIT` state to zero we get the following: ```asm example::ensure_init::h332061368366e313: ldapr w8, [x0] cbnz w8, LBB1_2 ret LBB1_2: b example::slow::ha042bd6a4f33724e ``` So this PR saves 1 instruction every time a `LazyLock` gets accessed on platforms such as these.
…-to-allocation, r=oli-obk Change "allocated object" to "allocation". These seem like they were missed in <rust-lang#141224>
Don't call WSACleanup on process exit This isn't necessary as cleanup will happen when the process exits regardless. fixes rust-lang#141799
…htriplett Updates to random number generation APIs Updates based on discussions about random number generation. - Add comment on `RandomSource::fill_bytes` about multiple calls, to allow efficient implementations for random sources that generate a word at a time. - Drop the `Random` trait in favor of `Distribution<T>`, which will let people make calls like random(1..=6), and which allows for future expansion to non-uniform distributions, as well as floating-point. (For now, this is only implemented for `RangeFull`, to get the interface in place. Subsequent PRs will implement it for other range types.)
and make internal terminology consistent Co-authored-by: Travis Cross <[email protected]>
…test `intrinsic-test`: use runner also for rust
Add rustc-pull CI automation workflow
`aarch64`: use more of `intrinsics::simd` for min/max
loongarch: Add basic support for LoongArch32
…intrinsic `s390x`: document the different rounding flavors
…k-Simulacrum core: Add `BorrowedCursor::with_unfilled_buf` Implementation of rust-lang/libs-team#367. This mainly adds `BorrowedCursor::with_unfilled_buf`, with enables using the unfilled part of a cursor as a `BorrowedBuf`. Note that unlike the ACP, `BorrowedCursor::unfilled_buf` was moved to a `From` conversion. This is more consistent with other ways of creating a `BorrowedBuf` and hides a bit this conversion that requires unsafe code to be used correctly. Cc rust-lang#78485 rust-lang#117693
`aarch64`: use `intrinsics::simd` for horizontal add and `abs`
…Noratrieb Update safety comment for new_unchecked in niche_types Change the safety comment on `new_unchecked` to mention the valid range instead of 0. I noticed this while working on https://github.com/model-checking/verify-rust-std
compiler & tools dependencies: Locking 14 packages to latest compatible versions Updating clap v4.5.41 -> v4.5.42 Updating clap_builder v4.5.41 -> v4.5.42 Updating jsonpath-rust v1.0.3 -> v1.0.4 Updating libredox v0.1.6 -> v0.1.9 Updating object v0.37.1 -> v0.37.2 Updating redox_syscall v0.5.16 -> v0.5.17 Updating redox_users v0.5.0 -> v0.5.2 Updating rustc-demangle v0.1.25 -> v0.1.26 Updating serde_json v1.0.141 -> v1.0.142 Updating wasm-encoder v0.235.0 -> v0.236.0 Updating wasmparser v0.235.0 -> v0.236.0 Updating wast v235.0.0 -> v236.0.0 Updating wat v1.235.0 -> v1.236.0 Updating windows-targets v0.53.2 -> v0.53.3 note: pass `--verbose` to see 36 unchanged dependencies behind latest library dependencies: Locking 3 packages to latest compatible versions Updating object v0.37.1 -> v0.37.2 Updating rustc-demangle v0.1.25 -> v0.1.26 Updating unwinding v0.2.7 -> v0.2.8 note: pass `--verbose` to see 2 unchanged dependencies behind latest rustbook dependencies: Locking 6 packages to latest compatible versions Updating cc v1.2.30 -> v1.2.31 Updating clap v4.5.41 -> v4.5.42 Updating clap_builder v4.5.41 -> v4.5.42 Updating redox_syscall v0.5.16 -> v0.5.17 Updating serde_json v1.0.141 -> v1.0.142 Updating windows-targets v0.53.2 -> v0.53.3
…Noratrieb Implement `hash_map` macro Implementation of rust-lang#144032 Implements the `hash_map` macro under `std/src/macros.rs`.
Weekly `cargo update` Automation to keep dependencies in `Cargo.lock` current. r? dep-bumps The following is the output from `cargo update`: ```txt compiler & tools dependencies: Locking 14 packages to latest compatible versions Updating clap v4.5.41 -> v4.5.42 Updating clap_builder v4.5.41 -> v4.5.42 Updating jsonpath-rust v1.0.3 -> v1.0.4 Updating libredox v0.1.6 -> v0.1.9 Updating object v0.37.1 -> v0.37.2 Updating redox_syscall v0.5.16 -> v0.5.17 Updating redox_users v0.5.0 -> v0.5.2 Updating rustc-demangle v0.1.25 -> v0.1.26 Updating serde_json v1.0.141 -> v1.0.142 Updating wasm-encoder v0.235.0 -> v0.236.0 Updating wasmparser v0.235.0 -> v0.236.0 Updating wast v235.0.0 -> v236.0.0 Updating wat v1.235.0 -> v1.236.0 Updating windows-targets v0.53.2 -> v0.53.3 note: pass `--verbose` to see 36 unchanged dependencies behind latest library dependencies: Locking 3 packages to latest compatible versions Updating object v0.37.1 -> v0.37.2 Updating rustc-demangle v0.1.25 -> v0.1.26 Updating unwinding v0.2.7 -> v0.2.8 note: pass `--verbose` to see 2 unchanged dependencies behind latest rustbook dependencies: Locking 6 packages to latest compatible versions Updating cc v1.2.30 -> v1.2.31 Updating clap v4.5.41 -> v4.5.42 Updating clap_builder v4.5.41 -> v4.5.42 Updating redox_syscall v0.5.16 -> v0.5.17 Updating serde_json v1.0.141 -> v1.0.142 Updating windows-targets v0.53.2 -> v0.53.3 ```
…ce-impl, r=Mark-Simulacrum Mark `slice::swap_with_slice` unstably const Tracking issue rust-lang#142204
…, r=Mark-Simulacrum `available_parallelism`: Add documentation for why we don't look at `ulimit`
…oss35 `AlignmentEnum` should just be `repr(usize)` now These used to use specific sizes because they were compiled on all widths. But now that the types themselves are `#[cfg]`'d, we can save some conversions by having it always be `repr(usize)`.
…lacrum Remove unnecessary `rust_` prefixes part of rust-lang#116005 Honestly, not sure if this can affect linking somehow, also I didn't touched things like `__rust_panic_cleanup` and `__rust_start_panic` which very likely will break something, so just small cleanup here also didn't changed `rust_panic_without_hook` because it was renamed here rust-lang#144852 r? libs
Rename `rust_panic_without_hook` to `resume_unwind` part of rust-lang#116005 r? libs
Use `as_array` in PartialEq for arrays Now that `as_array` exists we might as well use it here, since it's a bit more convenient than getting the correct type out of `try_into`.
…manieu Document Poisoning in `LazyCell` and `LazyLock` Currently, there is no documentation of poisoning behavior in either `LazyCell` or `LazyLock`, even though both of them can be observed as poisoned by users. `LazyCell` [plagyround example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=9cf38b8dc56db100848f54085c2c697d) `LazyLock` [playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f1cd6f9fe16636e347ebb695a0ce30c0) # Open Questions - [x] Is it worth making the implementation of `LazyLock` more complicated to ensure that the the panic message is `"LazyLock instance has previously been poisoned"` instead of `"Once instance has previously been poisoned"`? See the `LazyLock` playground link above for more context. - [x] Does it make sense to move `LazyLock` into the `poison` module? It is certainly a poison-able type, but at the same time it is slightly different from the 4 other types currently in the `poison` module in that it is unrecoverable. I think this is more of a libs-api question. ``@rustbot`` label +T-libs-api Please let me know if these open questions deserve a separate issue / PR!
feliperodri
approved these changes
Aug 6, 2025
tautschnig
approved these changes
Aug 6, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an automated PR to merge library subtree updates from 2025-08-01 (rust-lang/rust@adcb3d3) to 2025-08-06 (rust-lang/rust@ec7c026) (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: 7112d06