about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-08-02added regression test for `core::panic::Location::file`'s lifetimeIsaac Chen-0/+39
2025-08-02corrected lifetime in core::panic::Location::file return typeIsaac Chen-1/+1
2025-08-02Change visibility of Args new functionChristopher Hotchkiss-1/+1
Currently the Args new function is scope constrained to pub(super) but this stops me from being able to construct Args structs in unit tests.
2025-08-02use gcc 15 as the linker on loongarchFolkert de Vries-11/+11
2025-08-02fmt with table lookup for binary, octal and hexPascal S. de Kloe-122/+55
* correct buffer size * no trait abstraction * similar to decimal
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-31add Option::reduceJeremy Smart-0/+37
2025-07-31[Doc] Add links to the various collectionsBruno Roy-6/+6
Add a few links to the collections mentioned in the module doc for Collections.
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-31Merge ref '32e7a4b92b10' from rust-lang/rustThe rustc-josh-sync Cronjob Bot-908/+1813
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 32e7a4b92b109c24e9822c862a7c74436b50e564 Filtered ref: 56d8aa13f54944edb711f3bdd7013b082dbaa65b This merge was created using https://github.com/rust-lang/josh-sync.
2025-07-31Prepare for merging from rust-lang/rustThe rustc-josh-sync Cronjob Bot-1/+1
This updates the rust-version file to 32e7a4b92b109c24e9822c862a7c74436b50e564.
2025-07-30Stabilize strict_overflow_opsNurzhan Sakén-87/+54
2025-07-30Implement push_mutBalt-29/+243
2025-07-30Simplify the configuration for no-panicTrevor Gross-174/+174
Currently, attributes for `no-panic` are gated behind both the `test` config and `assert_no_panic`, because `no-panic` is a dev dependency (so only available with test configuration). However, we only emit `assert_no_panic` when the test config is also set anyway, so there isn't any need to gate on both. Replace gates on `all(test, assert_no_panic)` with only `assert_no_panic`. This is simpler, and also has the benefit that attempting to check for panics without `--test` errors.
2025-07-30ci: Set pipefail before running ci-utilTrevor Gross-1/+3
Currently, a failure in `ci-util.py` does not cause the job to fail because the pipe eats the failure status . Set pipefail to fix this. Fixes: ff2cc0e38e3e ("ci: Don't print output twice in `ci-util`")
2025-07-30ci: Add a way to run `libm` tests that would otherwise be skippedTrevor Gross-0/+13
Introduce a new directive `ci: test-libm` to ensure tests run.
2025-07-30ci: Commonize the way `PrInfo` is loaded from envTrevor Gross-10/+22
2025-07-30ci: Don't print output twice in `ci-util`Trevor Gross-3/+1
Use `tee` rather than printing to both stdout and stderr.
2025-07-30ci: Switch to strongly typed directivesTrevor Gross-25/+54
Replace the current system with something that is more structured and will also catch unknown directives.
2025-07-30`AlignmentEnum` should just be `repr(usize)` nowScott McMurray-3/+5
Since it's cfg'd instead of type-aliased
2025-07-30const-eval: full support for pointer fragmentsRalf Jung-45/+5
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-29ci: Simplify tests for verbatim pathsTrevor Gross-5/+4
Rather than setting an environment variable in the workflow job based on whether or not the environment is non-MinGW Windows, we can just check this in the ci script. This was originally added in b0f19660f0 ("Add tests for UNC paths on windows builds") and its followup commits.
2025-07-29cleanup: Trim trailing whitespaceTrevor Gross-4/+4
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.