about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-08-04Merge ref '07b7dc90ee4d' from rust-lang/rustThe Miri Cronjob Bot-152/+580
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 07b7dc90ee4df5815dbb91ef8e98cb93571230f5 Filtered ref: 3785af8cd0fe0eeb48a0f920ca3fae973cf842d7 This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-05Ignore sleep_until test on SGXRaoul Strackx-0/+1
2025-08-05Rollup merge of #144872 - connortsui20:once-poison-docs, r=AmanieuSamuel Tardieu-5/+118
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!
2025-08-05Rollup merge of #144867 - scottmcm:more-as-array, r=chenyukangSamuel Tardieu-16/+12
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`.
2025-08-05Rollup merge of #144852 - Kivooeo:rename-panic, r=m-ou-seSamuel Tardieu-2/+2
Rename `rust_panic_without_hook` to `resume_unwind` part of https://github.com/rust-lang/rust/issues/116005 r? libs
2025-08-04Rollup merge of #144853 - Kivooeo:rust_-cleanup, r=Mark-SimulacrumStuart Cook-6/+6
Remove unnecessary `rust_` prefixes part of https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/pull/144852 r? libs
2025-08-04Rollup merge of #144667 - scottmcm:alignment-is-usize, r=tgross35Stuart Cook-3/+5
`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)`.
2025-08-04Rollup merge of #144188 - joshtriplett:available-parallelism, r=Mark-SimulacrumStuart Cook-0/+3
`available_parallelism`: Add documentation for why we don't look at `ulimit`
2025-08-04Rollup merge of #142205 - paolobarbolini:const_swap_with_slice-impl, ↵Stuart Cook-1/+2
r=Mark-Simulacrum Mark `slice::swap_with_slice` unstably const Tracking issue rust-lang/rust#142204
2025-08-03add poisoning documentation to `LazyLock`Connor Tsui-2/+58
2025-08-03add poisoning documentation to `LazyCell`Connor Tsui-2/+59
2025-08-03fix broken doc section link in `poison.rs`Connor Tsui-1/+1
2025-08-03Rollup merge of #144843 - rust-lang:cargo_update, r=clubby789Samuel Tardieu-7/+6
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 ```
2025-08-03Rollup merge of #144070 - stifskere:feat/macros/hash_map, r=NoratriebSamuel Tardieu-0/+76
Implement `hash_map` macro Implementation of https://github.com/rust-lang/rust/issues/144032 Implements the `hash_map` macro under `std/src/macros.rs`.
2025-08-03Use `as_array` in PartialEq for arraysScott McMurray-16/+12
2025-08-03remove rust_ prefixesKivooeo-6/+6
2025-08-03rename rust_panic_without_hookKivooeo-2/+2
2025-08-03cargo updategithub-actions-7/+6
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
2025-08-02Rollup merge of #144797 - nilehmann:safety-comment-niche, r=NoratriebSamuel Tardieu-3/+3
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
2025-08-02Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=AmanieuSamuel Tardieu-34/+39
Improve formatting of doc code blocks We don't currently apply automatic formatting to doc comment code blocks. As a result, it has built up various idiosyncracies, which make such automatic formatting difficult. Some of those idiosyncracies also make things harder for human readers or other tools. This PR makes a few improvements to doc code formatting, in the hopes of making future automatic formatting easier, as well as in many cases providing net readability improvements. I would suggest reading each commit separately, as each commit contains one class of changes.
2025-08-02Rollup merge of #144185 - purplesyringa:poisoning-wording, r=AmanieuSamuel Tardieu-25/+87
Document guarantees of poisoning This mostly documents the current behavior of `Mutex` and `RwLock` (rust-lang/rust#143471) as imperfect. It's unlikely that the situation improves significantly in the future, and even if it does, the rules will probably be more complicated than "poisoning is completely reliable", so this is a conservative guarantee. We also explicitly specify that `OnceLock` never poisons, even though it has an API similar to mutexes. Fixes rust-lang/rust#143471 by improving documentation. r? ``@Amanieu``
2025-08-02Rollup merge of #143771 - Randl:const-result, r=tgross35Samuel Tardieu-25/+197
Constify some more `Result` functions
2025-08-02feat: implement `hash_map!` macrostifskere-0/+76
2025-08-01Fix safety comment for new_unchecked in niche_typesNico Lehmann-3/+3
2025-08-01Constify additional Result functionsEvgenii Zheltonozhskii-25/+197
2025-08-01Rollup merge of #144683 - tgross35:builtins-via-std-workspace, ↵Jacob Pratt-26/+24
r=bjorn3,Noratrieb Simplify library dependencies on `compiler-builtins` The three panic-related library crates need to have access to `core`, and `compiler-builtins` needs to be in the crate graph. Rather than specifying both dependencies, switch these crates to use `rustc-std-workspace-core` which already does this. This means there is now a single place that the `compiler-builtins` dependency needs to get configured, for everything other than `alloc` and `std`. The second commit removes `compiler-builtins` from `std` (more details in the message).
2025-07-31Correct some grammar in integer documentationTrevor Gross-18/+12
Update "between" to "among" (more than two items), connect the "which" dependent clause to the independent part, and remove the redundant "here".
2025-07-31Remove `std`'s dependency on `compiler-builtins`Trevor Gross-2/+0
`compiler-builtins` is already in the crate graph via `alloc`, and all features related to `compiler-builtins` goes through `alloc`. There isn't any reason that `std` needs this direct dependency, so remove it.
2025-07-31Use `core` via `rustc-std-workspace-core` in `library/panic*`Trevor Gross-13/+13
The three panic-related library crates need to have access to `core`, and `compiler-builtins` needs to be in the crate graph. Rather than specifying both dependencies, switch these crates to use `rustc-std-workspace-core` which already does this. This means there is now a single place that the `compiler-builtins` dependency needs to get configured, for everything other than `alloc` and `std`.
2025-07-31uefi: Use slice equality rather than `memcmp`Trevor Gross-11/+11
`compiler_builtins` shouldn't be called directly. Change the `PartialEq` implementation for `DevicePathNode` to use slice equality instead, which will call `memcmp`/`bcmp` via the intrinsic.
2025-07-31Rollup merge of #144721 - a4lg:riscv-hwprobe-linux-6.16, r=AmanieuSamuel Tardieu-4/+10
`std_detect`: Linux 6.16 support for RISC-V It adds feature detection of 1 extension (new in `std_detect`). New RISC-V Extension: 1. "Zabha"
2025-07-31Rollup merge of #144297 - GuillaumeGomez:ERROR_EXIT_CODE, r=AmanieuSamuel Tardieu-2/+2
Make `libtest::ERROR_EXIT_CODE` const public to not redefine it in rustdoc I think it's better to make this constant public so it can be used by crates using `libtest` as dependency. As a side-note, I will update https://github.com/rust-lang/rust/pull/143900 to make use of this constant once this is current PR is merged.
2025-07-31Make `libtest::ERROR_EXIT_CODE` const public to not redefine it in rustdocGuillaume Gomez-2/+2
2025-07-31std_detect: Linux 6.16 support for RISC-VTsukasa OI-4/+10
It adds feature detection of 1 extension (new in std_detect). New RISC-V Extension: 1. "Zabha"
2025-07-31Rollup merge of #135975 - balt-dev:master, r=tgross35Stuart Cook-29/+243
Implement `push_mut` Implementation of rust-lang/rust#135974.
2025-07-30Implement push_mutBalt-29/+243
2025-07-30`AlignmentEnum` should just be `repr(usize)` nowScott McMurray-3/+5
Since it's cfg'd instead of type-aliased
2025-07-29Auto merge of #144658 - jhpratt:rollup-jdzhz27, r=jhprattbors-3/+123
Rollup of 8 pull requests Successful merges: - rust-lang/rust#144034 (tests: Test line number in debuginfo for diverging function calls) - rust-lang/rust#144510 (Fix Ord, Eq and Hash implementation of panic::Location) - rust-lang/rust#144583 (Enable T-compiler backport nomination) - rust-lang/rust#144586 (Update wasi-sdk to 27.0 in CI) - rust-lang/rust#144605 (Resolve: cachify `ExternPreludeEntry.binding` through a `Cell`) - rust-lang/rust#144632 (Update some tests for LLVM 21) - rust-lang/rust#144639 (Update rustc-perf submodule) - rust-lang/rust#144640 (Add support for the m68k architecture in 'object_architecture') r? `@ghost` `@rustbot` modify labels: rollup
2025-07-29Rollup merge of #144510 - orlp:fix-location-ord, r=ibraheemdevJacob Pratt-3/+123
Fix Ord, Eq and Hash implementation of panic::Location Fixes https://github.com/rust-lang/rust/issues/144486. Now properly compares/hashes the filename rather than the pointer to the string.
2025-07-29Auto merge of #144393 - heiher:str-contains-lsx, r=tgross35bors-3/+16
LoongArch64 LSX fast-path for `str.contains(&str)` Benchmark results with LLVM 21 on LA664: ``` OLD: test bench_is_contained_in ... bench: 43.63 ns/iter (+/- 0.04) NEW: test bench_is_contained_in ... bench: 12.81 ns/iter (+/- 0.01) ```
2025-07-29Fix Ord, Eq and Hash implementation of panic::LocationOrson Peters-3/+123
Faster equality compare Add tests Add missing files for tests
2025-07-29Rollup merge of #144634 - lucaswerkmeister:patch-1, r=lqdStuart Cook-1/+1
Fix typo in `DropGuard` doc Follows-up rust-lang/rust#144236 (I happened to see the typo yesterday but didn’t think it should delay the PR’s merge so I kept quiet, sorryyyyy).
2025-07-29LoongArch64 LSX fast-path for `str.contains(&str)`WANG Rui-3/+16
Benchmark results with LLVM 21 on LA664: ``` OLD: test bench_is_contained_in ... bench: 43.63 ns/iter (+/- 0.04) NEW: test bench_is_contained_in ... bench: 12.81 ns/iter (+/- 0.01) ```
2025-07-29Fix typo in `DropGuard` docLucas Werkmeister-1/+1
2025-07-29Rollup merge of #144500 - joboet:thread-name-stack-overflow, r=ChrisDentonStuart Cook-29/+78
thread name in stack overflow message Fixes rust-lang/rust#144481, which is caused by the thread name not being initialised yet when setting up the stack overflow information. Unfortunately, the stack overflow UI test did not test for the correct thread name being present, and testing this separately didn't occur to me when writing https://github.com/rust-lang/rust/pull/140628. This PR contains the smallest possible fix I could think of: passing the thread name explicitly to the platform thread creation function. In the future I'd very much like to explore some possibilities around merging the thread packet and thread handle into one structure and using that in the platform code instead – but that's best left for another PR. This PR also amends the stack overflow test to check for thread names, so we don't run into this again. ``@rustbot`` label +beta-nominated
2025-07-29Rollup merge of #144167 - zachs18:rangebounds-not-unsized-reason, r=tgross35Stuart Cook-0/+48
Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative. `Range*<&T> as RangeBounds<T>` impls have been tried to be relaxed to `T: ?Sized` at least twice: * https://github.com/rust-lang/rust/pull/61584 * https://github.com/rust-lang/rust/pull/64327 I also was just about to make another PR to do it again until I `./x.py test library/alloc` and rediscovered the type inference regression, then searched around and found the previous PRs. Hence this PR instead so hopefully that doesn't keep happening :stuck_out_tongue:. These impls cannot be relaxed for two reasons: 1. Type inference regressions: See ``@SimonSapin's`` explanation from a previous PR: https://github.com/rust-lang/rust/pull/61584#issuecomment-499601046 2. It's a breaking change: `impl RangeBounds<MyUnsizedType> for std::ops::Range<&MyUnsizedType>` is allowed after the coherence rebalance ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f704a6fe53bfc33e55b2fc246d895ec2)), and relaxing these impls would conflict with that downstream impl. This PR adds doc-comments explaining that not having `T: ?Sized` is intentional[^1], and gives an explicit alternative: `(Bound<&T>, Bound<&T>)`. Technically, the impls for the unstable new `std::range` types could be relaxed, as they are still unstable so the change would not be breaking, but having them be different in this regard seems worse (and the non-iterable `RangeTo/RangeToInclusive` range types are shared between the "new" and "old" so cannot be changed anyway), and then the type inference regression would pop up in whatever edition the new range types stabilize in. The "see \<link\> for discussion of those issues" is intentionally left as a non-doc comment just for whoever may try to relax these impls again in the future, but if it is preferred to have the link in the docs I can add that. Closes https://github.com/rust-lang/rust/issues/107196 (as wontfix) CC https://github.com/rust-lang/rust/issues/64027 [^1]: "intentional" is maybe a bit of strong wording, should it instead say something like "was stabilized without it and it would be breaking to change it now"?
2025-07-29Rollup merge of #144022 - connortsui20:sync_nonpoison, r=tgross35Stuart Cook-202/+1038
Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]` Continuation of https://github.com/rust-lang/rust/pull/134663 Tracking Issue: https://github.com/rust-lang/rust/issues/134645 This PR implements a new `sync/nonpoison` module, as well as the `nonpoison` variant of the `Mutex` lock. There are 2 main changes here, the first is the new `nonpoison::mutex` module, and the second is the `mutex` integration tests. For the `nonpoison::mutex` module, I did my best to align it with the current state of the `poison::mutex` module. This means that several unstable features (`mapped_lock_guards`, `lock_value_accessors`, and `mutex_data_ptr`) are also in the new `nonpoison::mutex` module, under their respective feature gates. Everything else in that file is under the correct feature gate (`#[unstable(feature = "nonpoison_mutex", issue = "134645")]`). Everything in the `nonpoison::mutex` file is essentially identical in spirit, as we are simply removing the error case from the original `poison::mutex`. The second big change is in the integration tests. I created a macro called that allows us to duplicate tests that are "generic" over the different mutex types, in that the poison mutex is always `unwrap`ped. ~~I think that there is an argument against doing this, as it can make the tests a bit harder to understand (and language server capabilities are weaker within macros), but I think the benefit of code deduplication here is worth it. Note that it is definitely possible to generalize this (with a few tweaks) to testing the other `nonpoison` locks when they eventually get implemented, but I'll leave that for a later discussion.~~
2025-07-29add extra drop, panic, and unwind testsConnor Tsui-22/+80
2025-07-29add nonpoison and poison mutex testsConnor Tsui-146/+260
Adds tests for the `nonpoison::Mutex` variant by using a macro to duplicate the existing `poison` tests. Note that all of the tests here are adapted from the existing `poison` tests.
2025-07-29reorder mutex testsConnor Tsui-144/+158
This commit simply helps discern the actual changes needed to test both poison and nonpoison locks.