about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-06-02ci: Refactor benchmark regression checksTrevor Gross-74/+29
iai-callgrind now correctly exits with error if regressions were found [1], so we no longer need to check for regressions manually. Remove this check and instead exit based on the exit status of the benchmark run. [1] https://github.com/iai-callgrind/iai-callgrind/issues/337
2025-06-02Stabilize AVX512 intrinsicsAmanieu d'Antras-4595/+4595
FCP completed in tracking issue rust-lang/rust#111137
2025-06-02Fix incorrect intrinsic name in WASMsayantn-2/+2
2025-06-02Fix incorrect intrinsic name in X86sayantn-11/+11
2025-06-02Remove uses of deprecated type-specific pointers from ARMsayantn-380/+380
2025-06-02Use correct LLVM intrinsic for `vmull` and `vaddv`sayantn-36/+36
2025-06-02Use rust intrinsics for more ARM intrinsicssayantn-527/+73
2025-06-02Mark Neon f16 vectors as unstableAdam Gemmell-4/+9
2025-06-02Revert vbsl[q]_f16 to unstableAdam Gemmell-18/+3
2025-06-02Remove bootstrap cfgs from library/Josh Stone-122/+13
2025-06-02Lightly tweak docs for BTree{Map,Set}::extract_ifSidney Cammeresi-7/+7
- Move explanations into comments to match style - Explain the second examples - Make variable names match the data structure
2025-06-02cleanup: Use `x.biteq(y)` rather than `x.to_bits() == y.to_bits()`Trevor Gross-19/+14
2025-06-02Disable f64 minimum/maximum tests for arm 32Eric Huss-2/+2
This disables the f64 minimum/maximum tests for the arm-unknown-linux-gnueabihf job. The next release will be supporting cross-compiled doctests, and these tests fail on that platform. It looks like this was just fixed via https://github.com/llvm/llvm-project/pull/142170, but I assume that will not trickle down to our copy of llvm in the next couple of weeks. Assuming that does get fixed when llvm is updated, then these can be removed. cc https://github.com/rust-lang/rust/issues/141087
2025-06-02Rollup merge of #141874 - usamoi:eps, r=tgross35Jakub Beránek-0/+2
add f16_epsilon and f128_epsilon diagnostic items cc https://github.com/rust-lang/rust/issues/116909 r? ``@tgross35``
2025-06-02Rollup merge of #141858 - zacryol:spe-docs-typo, r=aDotInTheVoidJakub Beránek-1/+1
Fix typo in `StructuralPartialEq` docs `equialent` => `equivalent`
2025-06-02remove f16: From<u16>usamoi-1/+0
2025-06-02Explain TOCTOU on the top of `std::fs`, and ref it in functionsxizheyin-15/+41
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn> Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-02add f16_epsilon and f128_epsilonusamoi-0/+2
2025-06-02Fixed a typo in `ManuallyDrop`'s docneeko-cat-1/+1
2025-06-01RISC-V: Linux 6.15 `riscv_hwprobe` supportTsukasa OI-3/+39
This commit adds support for `riscv_hwprobe` on the Linux kernel 6.15. It adds feature detection of 8 extensions (4 of them are new in this). Existing RISC-V Extensions: 1. "Zicntr" 2. "Zihpm" 3. "Zalrsc" 4. "Zaamo" New RISC-V Extensions: 5. "Zicbom" 6. "Zfbfmin" 7. "Zvfbfmin" 8. "Zvfbfwma"
2025-06-01use `simd_bitreverse` on `aarch64`Folkert de Vries-21/+5
2025-06-01Upgrade all dependencies to the latest available versionTrevor Gross-16/+16
In particular, this includes a fix to `iai-callgrind` that will allow us to simplify our benchmark runner.
2025-06-01Fix new `dead_code` warnings from recent nightliesTrevor Gross-103/+116
2025-06-01Rollup merge of #141224 - RalfJung:no-objects, r=traviscrossGuillaume Gomez-142/+145
terminology: allocated object → allocation Rust does not have "objects" in memory so "allocated object" is a somewhat odd name. I am not sure where the term comes from. "object" has been used to refer to allocations already [in 1.0 docs](https://doc.rust-lang.org/1.0.0/std/primitive.pointer.html#method.offset); this was apparently later changed to "allocated object". "Allocation" is already the terminology used in Miri and in the [UCG](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#allocation). We should properly move to that terminology, and avoid any confusion about whether Rust has an object memory model. (It does not. Memory contains untyped bytes.) Cc ``@rust-lang/opsem`` ``@rust-lang/lang``
2025-06-01Fix typo in `StructuralPartialEq` docszacryol-1/+1
`equialent` => `equivalent`
2025-06-01Auto merge of #141842 - jhpratt:rollup-r7ldrl2, r=jhprattbors-70/+279
Rollup of 6 pull requests Successful merges: - rust-lang/rust#141072 (Stabilize feature `result_flattening`) - rust-lang/rust#141215 (std: clarify Clone trait documentation about duplication semantics) - rust-lang/rust#141277 (Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target) - rust-lang/rust#141521 (Add `const` support for float rounding methods) - rust-lang/rust#141812 (Fix "consider borrowing" for else-if) - rust-lang/rust#141832 (library: explain TOCTOU races in `fs::remove_dir_all`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-01Rollup merge of #141832 - workingjubilee:explain-what-toctou-races-are, ↵Jacob Pratt-8/+19
r=thomcc,ChrisDenton library: explain TOCTOU races in `fs::remove_dir_all` In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such. Incidentally, it also fixes the capitalization on the name of Redox OS. Original CVE and advisory: - CVE: https://www.cve.org/CVERecord?id=CVE-2022-21658 - security advisory: https://groups.google.com/g/rustlang-security-announcements/c/R1fZFDhnJVQ?pli=1 - github cross-post: https://github.com/rust-lang/rust/security/advisories/GHSA-r9cc-f5pr-p3j2
2025-06-01Rollup merge of #141521 - ruancomelli:const-float-rounding, r=RalfJungJacob Pratt-56/+220
Add `const` support for float rounding methods # Add `const` support for float rounding methods This PR makes the following float rounding methods `const`: - `f64::{floor, ceil, trunc, round, round_ties_even}` - and the corresponding methods for `f16`, `f32` and `f128` Tracking issue: https://github.com/rust-lang/rust/issues/141555 ## Procedure I followed https://github.com/rust-lang/rust/commit/c09ed3e767a73d83673790f74c357432fa44d320 as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli. ## Note This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
2025-06-01Rollup merge of #141215 - xizheyin:issue-141138, r=workingjubileeJacob Pratt-2/+37
std: clarify Clone trait documentation about duplication semantics Closes rust-lang/rust#141138 The change explicitly explains that cloning behavior varies by type and clarifies that smart pointers (`Arc`, `Rc`) share the same underlying data. I've also added an example of cloning to Arc.
2025-06-01Rollup merge of #141072 - Rynibami:stabilize-const-result-flatten, r=jhprattJacob Pratt-4/+3
Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: https://github.com/rust-lang/rust/pull/70140 - [x] Implementation `const` `Result::flatten`: https://github.com/rust-lang/rust/pull/130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](https://github.com/rust-lang/rust/issues/70142#issuecomment-2885044548) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang/rust#70142
2025-05-31If HOME is empty, use the fallback insteadChris Denton-2/+5
2025-05-31Auto merge of #139118 - scottmcm:slice-get-unchecked-intrinsic, r=workingjubileebors-20/+120
`slice.get(i)` should use a slice projection in MIR, like `slice[i]` does `slice[i]` is built-in magic, so ends up being quite different from `slice.get(i)` in MIR, even though they're both doing nearly identical operations -- checking the length of the slice then getting a ref/ptr to the element if it's in-bounds. This PR adds a `slice_get_unchecked` intrinsic for `impl SliceIndex for usize` to use to fix that, so it no longer needs to do a bunch of lines of pointer math and instead just gets the obvious single statement. (This is *not* used for the range versions, since `slice[i..]` and `slice[..k]` can't use the mir Slice projection as they're using fenceposts, not indices.) I originally tried to do this with some kind of GVN pattern, but realized that I'm pretty sure it's not legal to optimize `BinOp::Offset` to `PlaceElem::Index` without an extremely complicated condition. Basically, the problem is that the `Index` projection on a dereferenced slice pointer *cares about the metadata*, since it's UB to `PlaceElem::Index` outside the range described by the metadata. But then you cast the fat pointer to a thin pointer then offset it, that *ignores* the slice length metadata, so it's possible to write things that are legal with `Offset` but would be UB if translated in the obvious way to `Index`. Checking (or even determining) the necessary conditions for that would be complicated and error-prone, whereas this intrinsic-based approach is quite straight-forward. Zero backend changes, because it just lowers to MIR, so it's already supported naturally by CTFE/Miri/cg_llvm/cg_clif.
2025-05-31library: explain TOCTOU races in `fs::remove_dir_all`Jubilee Young-8/+19
In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such. Incidentally, it also fixes the capitalization on the name of Redox OS.
2025-05-31terminology: allocated object → allocationRalf Jung-142/+145
2025-05-31Add const support for float rounding methodsRuan Comelli-56/+220
Add const support for the float rounding methods floor, ceil, trunc, fract, round and round_ties_even. This works by moving the calculation logic from src/tools/miri/src/intrinsics/mod.rs into compiler/rustc_const_eval/src/interpret/intrinsics.rs. All relevant method definitions were adjusted to include the `const` keyword for all supported float types: f16, f32, f64 and f128. The constness is hidden behind the feature gate feature(const_float_round_methods) which is tracked in https://github.com/rust-lang/rust/issues/141555 This commit is a squash of the following commits: - test: add tests that we expect to pass when float rounding becomes const - feat: make float rounding methods `const` - fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs` - revert: undo update to `library/stdarch` - refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one - fix: add `#[cfg(not(bootstrap))]` to new const method tests - test: add extra sign tests to check `+0.0` and `-0.0` - revert: undo accidental changes to `round` docs - fix: gate `const` float round method behind `const_float_round_methods` - fix: remove unnecessary `#![feature(const_float_methods)]` - fix: remove unnecessary `#![feature(const_float_methods)]` [2] - revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs` - fix: adjust after rebase - test: fix float tests - test: add tests for `fract` - chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128` - fix: adjust NaN when rounding floats - chore: add FIXME comment for de-duplicating float tests - test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs` - test: fix tests after upstream simplification of how float tests are run
2025-05-31Auto merge of #141824 - matthiaskrgr:rollup-7nffwd0, r=matthiaskrgrbors-4/+12
Rollup of 8 pull requests Successful merges: - rust-lang/rust#140787 (Note expr being cast when encounter NonScalar cast error) - rust-lang/rust#141112 (std: note that `std::str::from_utf8*` functions are aliases to `<str>::from_utf8*` methods) - rust-lang/rust#141646 (Document what `distcheck` is intended to exercise) - rust-lang/rust#141740 (Hir item kind field order) - rust-lang/rust#141793 (`tests/ui`: A New Order [1/N]) - rust-lang/rust#141805 (Update `compiler-builtins` to 0.1.160) - rust-lang/rust#141815 (Enable non-leaf Frame Pointers for mingw-w64 Arm64 Windows) - rust-lang/rust#141819 (Fixes for building windows-gnullvm hosts) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-31Rollup merge of #141805 - tgross35:update-builtins, r=tgross35Matthias Krüger-4/+4
Update `compiler-builtins` to 0.1.160 Includes the following changes: * Enable `__powitf2` on MSVC [1] * Update `CmpResult` to use a pointer-sized return type [2] * Better code reuse between `libm` and `compiler-builtins` [3], [4] * Stop building C versions of `__netf2` [5] since we have our own implementation [1]: https://github.com/rust-lang/compiler-builtins/pull/918 [2]: https://github.com/rust-lang/compiler-builtins/pull/920 [3]: https://github.com/rust-lang/compiler-builtins/pull/879 [4]: https://github.com/rust-lang/compiler-builtins/pull/925 [5]: https://github.com/rust-lang/compiler-builtins/pull/828
2025-05-31Rollup merge of #141112 - xizheyin:issue-141079, r=Mark-SimulacrumMatthias Krüger-0/+8
std: note that `std::str::from_utf8*` functions are aliases to `<str>::from_utf8*` methods Closes #141079 r? libs
2025-05-31Auto merge of #141685 - orlp:inplace-tls-drop, r=joboetbors-29/+51
Do not move thread-locals before dropping Fixes rust-lang/rust#140816. I also (potentially) improved the speed of `get_or_init` a bit by having an explicit hot/cold path. We still move the value before dropping in the event of a recursive initialization (leading to double-initialization with one value being silently dropped). This is the old behavior, but changing this to panic instead would involve changing tests and also the other OS-specific `thread_local/os.rs` implementation, which is more than I'd like in this PR.
2025-05-31std: note that `std::str::from_utf8*` functions are aliases to ↵xizheyin-0/+8
`std::<str>::from_utf8*` methods Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-31intrinsic-test: Reverse `has_constraints()` conditionTsukasa OI-1/+1
It seems it returns true when *no* constraints are found, opposite to the expected behavior of the function name. This commit reverses condition as the name suggests.
2025-05-31intrinsic-test: Use `c_prefix` to generate type namesTsukasa OI-1/+1
To make the type names to test correct, this commit replaces occurrences of `rust_prefix` to `c_prefix` where necessary.
2025-05-31Stabilize `sha512`, `sm3` and `sm4` intrinsics and runtime detectionsayantn-13/+13
2025-05-31Stabilize keylocker intrinsics and runtime detectionsayantn-14/+14
2025-05-31intrinsic-test: Modernization of the coding styleTsukasa OI-95/+91
It modernizes the coding style of the crate intrinsic-test by fixing Clippy warnings. Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28) Number of Fixed Warnings: 36/36
2025-05-31stdarch_examples: Modernization of the coding styleTsukasa OI-24/+24
It modernizes the coding style of the crate stdarch_examples (an example "connect5") by fixing Clippy warnings (except clippy::manual_range_contains in which "fixing" the warning will complicate the code). Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28) Number of Fixed Warnings: 6/6
2025-05-31stdarch-verify: Modernization of the coding styleTsukasa OI-0/+2
It modernizes the coding style of the crate stdarch-verify by dealing with Clippy warnings (allows clippy::collapsible_if but review may be required for later changes). Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28) Number of Fixed Warnings: 4/4
2025-05-31stdarch-test: Modernization of the coding styleTsukasa OI-1/+1
It modernizes the coding style of the crate stdarch-test by fixing Clippy warnings. Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28) Number of Fixed Warnings: 1/1
2025-05-31stdarch-gen-loongarch: Modernization of the coding styleTsukasa OI-1/+1
It modernizes the coding style of the crate stdarch-gen-loongarch by fixing Clippy warnings. Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28) Number of Fixed Warnings: 1/1 Confirmed that the exact same code will be generated (note that, generated.rs in the repository is *not* an exact output but some spaces removed).
2025-05-31stdarch-gen-arm: Modernization of the coding styleTsukasa OI-170/+76
It modernizes the coding style of the crate stdarch-gen-arm by fixing Clippy warnings (except clippy::{collapsible_if,obfuscated_if_else} that might make the program look worse as a result of "fixing" warnings). Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28) Number of Fixed Warnings: 84/84 Note: Rust Analyzer double counts one of the Clippy warnings so it reduces 85 warnings (as reported by the Rust Analyzer). This commit also applies similar technique used to resolve Clippy warnings but also simplifies identifier name formatting and makes reading easier. Confirmed that the exact same code will be generated.