about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-03-01docs(std): mention LazyLock in const/static HashMap constructionKarol Zwolak-7/+19
2025-03-01fix `RangeBounds::is_empty` documentationPeter Jaszkowiak-1/+1
One-sided ranges are never empty
2025-03-01Use `BinOp::Cmp` for `iNN::signum`Scott McMurray-8/+7
This way it can use the nice new LLVM intrinsic in LLVM20.
2025-03-01Update `compiler-builtins` to 0.1.150Trevor Gross-4/+4
Includes a change to make a subset of math symbols available on all platforms [1], and disables `f16` on aarch64 without neon [2]. [1]: https://github.com/rust-lang/compiler-builtins/pull/763 [2]: https://github.com/rust-lang/compiler-builtins/pull/775
2025-03-01chore: release v0.1.150github-actions[bot]-1/+8
2025-03-01Disable `f16` on AArch64 without the `neon` featureTrevor Gross-0/+2
There is an LLVM regression that breaks some `f16`-related code when `fp-armv8` is disabled [1]. Since Rust ties that feature to `neon`, disable `f16` if `neon` is not available. [1]: https://github.com/llvm/llvm-project/issues/129394
2025-03-02uefi: Add Service Binding Protocol abstractionAyush Singh-1/+60
- Some UEFI protocols such as TCP4, TCP6, UDP4, UDP6, etc are managed by service binding protocol. - A new instance of such protocols is created and destroyed using the corresponding service binding protocol. - This PR adds abstractions to make using such protocols simpler using Rust Drop trait. - The reason to add these abstractions in a seperate PR from TCP4 Protocol is to make review easier. [EFI_SERVICE_BINDING_PROTCOL](https://uefi.org/specs/UEFI/2.11/11_Protocols_UEFI_Driver_Model.html#efi-service-binding-protocol) Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-03-01Rollup merge of #137828 - folkertdev:simd-intrinsic-doc-fixes, r=workingjubileeMatthias Krüger-36/+34
Fix inaccurate `std::intrinsics::simd` documentation This addresses two issues: - the docs on comparison operators (`simd_gt` etc.) said they only work for floating-point vectors, but they work for integer vectors too. - the docs on various functions that use a mask did not document that the mask must be a signed integer vector. Unsigned integer vectors would cause invalid behavior when the mask vector is widened (unsigned integers would use zero extension, producing incorrect results). r? ``@workingjubilee``
2025-03-01Rollup merge of #137809 - Noratrieb:io-error-casing, r=thomccMatthias Krüger-75/+75
Use correct error message casing for `io::const_error`s Error messages are supposed to start with lowercase letters, but a lot of `io::const_error` messages did not. This fixes them to start with a lowercase letter. I did consider adding a const check for this to the macro, but some of them start with proper nouns that make sense to uppercase them. See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-03-01stabilize `box_uninit_write`Slanterns-4/+1
2025-03-01Rollup merge of #137730 - RalfJung:checked_ilog_tests, r=tgross35Matthias Krüger-18/+56
checked_ilog tests: deal with a bit of float imprecision Fixes https://github.com/rust-lang/rust/issues/137591 r? `@tgross35`
2025-02-28Fix logic error in Buffer::read_more()Will Woods-2/+2
Buffer::read_more() is supposed to refill the buffer without discarding its contents, which are in the range `pos .. filled`. It mistakenly borrows the range `pos ..`, fills that, and then increments `filled` by the amount read. This overwrites the buffer's existing contents and sets `filled` to a too-large value that either exposes uninitialized bytes or walks off the end of the buffer entirely. This patch makes it correctly fill only the unfilled portion of the buffer, which should maintain all the type invariants and fix the test failure introduced in commit b1196717fcb.
2025-02-28Tweak BufReader::peek() doctest to expose bug in Buffer::read_more()Will Woods-3/+3
This patch makes BufReader::peek()'s doctest call read_more() to refill the buffer before the inner reader hits EOF. This exposes a bug in read_more() that causes an out-of-bounds slice access and segfault.
2025-03-01intrinsics::simd: document that masks must be signed integer vectorsFolkert de Vries-27/+27
this is because they may be widened, and that only works when sign extension is used: zero extension would produce invalid results
2025-03-01correct the docs on `simd_` comparison operatorsFolkert de Vries-15/+13
these all also accept integer vectors as arguments
2025-02-28Stabilize [T]::split_off... methodsTaylor Cramer-28/+7
This was previously known as the slice_take feature.
2025-02-28Specialize constructing OsString from stringsThalia Archibald-1/+24
The WTF-8 version of `OsString` tracks whether it is known to be valid UTF-8 with its `is_known_utf8` field. Specialize `From<AsRef<OsStr>>` so this can be set for UTF-8 string types.
2025-02-28Specialize OsString::push for stringsThalia Archibald-1/+34
When concatenating two WTF-8 strings, surrogate pairs at the boundaries need to be joined. However, since UTF-8 strings cannot contain surrogate halves, this check can be skipped when one string is UTF-8. Specialize `OsString::push` to use a more efficient concatenation in this case. Unfortunately, a specialization for `T: AsRef<str>` conflicts with `T: AsRef<OsStr>`, so stamp out string types with a macro.
2025-02-28Use correct error message casing for `io::const_error`sNoratrieb-75/+75
Error messages are supposed to start with lowercase letters, but a lot of `io::const_error` messages did not. This fixes them to start with a lowercase letter. I did consider adding a const check for this to the macro, but some of them start with proper nouns that make sense to uppercase them. See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-02-28Do not require that unsafe fields lack drop glueJack Wrenn-2/+2
Instead, we adopt the position that introducing an `unsafe` field itself carries a safety invariant: that if you assign an invariant to that field weaker than what the field's destructor requires, you must ensure that field is in a droppable state in your destructor. See: - https://github.com/rust-lang/rfcs/pull/3458#discussion_r1971676100 - https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/unsafe.20fields.20RFC/near/502113897
2025-02-28Rollup merge of #137673 - ChrisDenton:search-path-bug, r=dtolnay许杰友 Jieyou Xu (Joe)-1/+2
Fix Windows `Command` search path bug Currently `Command::new` on Windows works differently depending on whether any environment variable is set. For example, ```rust // Searches for "myapp" in the application and system paths first (aka Windows native behaviour). Command::new("myapp").spawn(); // Search for "myapp" in `PATH` first Command::new("myapp").env("a", "b").spawn(); ``` This is a bug because the search path should only change if `PATH` is changed for the child (i.e. `.env("PATH", "...")`). This was discussed in a libs-api meeting where the exact semantics of `Command::new` was not decided but there seemed to be broad agreement that this particular thing is just a bug that can be fixed. r? libs-api
2025-02-28Rollup merge of #137551 - folkertdev:import-simd-intrinsics, r=RalfJung许杰友 Jieyou Xu (Joe)-2/+2
import `simd_` intrinsics In most cases, we can import the simd intrinsics rather than redeclare them. Apparently, most of these tests were written before `std::intrinsics::simd` existed. There are a couple of exceptions where we can't yet import: - the intrinsics are not declared as `const fn` in the standard library, causing issues in the `const-eval` tests - the `simd_shuffle_generic` function is not exposed from `std::intrinsics` - the `simd_fpow` and `simd_fpowi` functions are not exposed from `std::intrinsics` (removed in https://github.com/rust-lang/rust/pull/137595) - some tests use `no_core`, and therefore cannot use `std::intrinsics` r? ```@RalfJung``` cc ```@workingjubilee``` do you have context on why some intrinsics are not exposed?
2025-02-28Rollup merge of #137197 - scottmcm:cmp-20, r=ibraheemdev许杰友 Jieyou Xu (Joe)-4/+4
Update some comparison codegen tests now that they pass in LLVM20 Fixes #106107 Needed one tweak to the default `PartialOrd::le` to get the test to pass. Everything but the derived 2-field `le` test passes even without the change to the defaults in the trait.
2025-02-27Fix char count in Display for ByteStrThalia Archibald-1/+3
2025-02-28Fix doctests failing due to unused_unsafeEric Huss-0/+6
2025-02-27Override default Write methods for cursor-like typesThalia Archibald-14/+143
2025-02-27Inline VecDeque<u8> and BorrowedCursor methodsThalia Archibald-0/+3
All other methods in this file have #[inline] and these methods are very similar to those of &[u8] which are already inlined here.
2025-02-27Count char width at most once in Formatter::padThalia Archibald-37/+29
When both width and precision flags are specified, then the character width is counted twice. Instead, record the character width when truncating it to the precision, so it does not need to be recomputed. Simplify control flow so the cases are more clear.
2025-02-27mark arm intrinsics as safeusamoi-23856/+16964
2025-02-27Update simd128.rsTobias Decking-12/+4
2025-02-27checked_ilog tests: deal with a bit of float imprecisionRalf Jung-18/+56
2025-02-27make `simd_insert` and `simd_extract` `const fn`sFolkert de Vries-2/+2
2025-02-27Delete tuple unsizingAlice Ryhl-10/+1
2025-02-27Rollup merge of #137480 - fuzzypixelz:fix/124466, r=workingjubileeMatthias Krüger-1/+10
Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes #124466.
2025-02-27Rollup merge of #137304 - pitaj:rangebounds-is_empty-intersect, r=ibraheemdevMatthias Krüger-5/+135
add `IntoBounds::intersect` and `RangeBounds::is_empty` - ACP: https://github.com/rust-lang/libs-team/issues/539 - Tracking issue for `is_empty`: #137300 - Tracking issue for `IntoBounds`: #136903
2025-02-27require trait impls to have matching const stabilities as the traitsDeadbeef-0/+4
2025-02-26Rollup merge of #137620 - SergioGasquez:fix/espidf-maybeunit, r=ChrisDentonLeón Orell Valerian Liehr-1/+1
Fix `attr` cast for espidf https://github.com/rust-lang/rust/pull/136826 broke ESP-IDF builds with: https://github.com/esp-rs/esp-idf-template/actions/runs/13516221587/job/37765336588. This PR fixes it. cc: ``@ivmarkov`` ``@xizheyin``
2025-02-26Rollup merge of #136187 - hkBst:patch-27, r=workingjubileeLeón Orell Valerian Liehr-36/+37
Use less CString in the examples of CStr. Fixes #83999
2025-02-26Rollup merge of #134585 - cyrgani:uninit_array, r=AmanieuLeón Orell Valerian Liehr-36/+0
remove `MaybeUninit::uninit_array` Closes #134584. Closes #66845. The future of this unstable method was described in https://github.com/rust-lang/rust/pull/125082#issuecomment-2161242816. Since `inline_const` was stabilized in 1.79 (4 stable releases away) and no one expressed interest for keeping it in https://github.com/rust-lang/rust/issues/96097, I think it can be removed now as it is not a stable method.
2025-02-26Fix unused import in coretests on wasm32bjorn3-2/+1
2025-02-26Fix Windows `Command` search path bugChris Denton-1/+2
2025-02-26Enable `f16` for LoongArchWANG Rui-1/+0
2025-02-26fix - neon type signed unsigned conversionsJames Barford-Evans-824/+826
2025-02-26Update LLVM downloads to 20.1-2025-02-13Trevor Gross-3/+3
This matches the version used by rust-lang/rust.
2025-02-26Rollup merge of #137614 - xizheyin:issue-134874, r=cuviperLeón Orell Valerian Liehr-2/+2
fix doc in library/core/src/pin.rs Fixes #134874
2025-02-26Rollup merge of #137311 - martn3:enable-f16-mips, r=tgross35León Orell Valerian Liehr-1/+0
Enable `f16` for MIPS Blocked on https://github.com/rust-lang/compiler-builtins/pull/762 It seems as if `f16` works on MIPS now according to my testing on Rust master with LLVM 20, and I was asked [here](https://github.com/rust-lang/rust/pull/137167#issuecomment-2669387820) to create PRs with my changes. I only tested on the flavour of `mipsel-unknown-linux-gnu` hardware that happens to be available to me, so I can't say anything about other MIPS hardware, but from a casual skimming of the LLVM code ([1], [2]) it seems like `f16` should work on all MIPS hardware. So enable it for all MIPS hardware. [1]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/Target/Mips/MipsISelLowering.h#L370 [2]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/CodeGen/TargetLoweringBase.cpp#L1367-L1388 `@rustbot` label +O-MIPS +F-f16_and_f128 +S-blocked Tracking issue for f16: https://github.com/rust-lang/rust/issues/116909 r? `@tgross35`
2025-02-26Rollup merge of #137154 - thaliaarchi:wtf8-fast-paths, r=ChrisDentonLeón Orell Valerian Liehr-3/+27
Add UTF-8 validation fast paths in `Wtf8Buf` This adds two more fast paths for UTF-8 validation in `Wtf8Buf`, making use of the `is_known_utf8` flag added in https://github.com/rust-lang/rust/pull/96869 (Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8). r? `@ChrisDenton`
2025-02-25Auto merge of #137594 - RalfJung:miri-sync, r=RalfJungbors-0/+1
Miri subtree update r? `@ghost` try-job: x86_64-gnu-aux
2025-02-25More precisely document `Global::deallocate()`'s safety.Kevin Reid-2/+8
There is a subtlety which "other conditions must be upheld by the caller" does not capture: `GlobalAlloc`/`alloc::dealloc()` require that the provided layout will be *equal*, not just that it "fits", the layout used to allocate. This is always true here due to how `allocate()`, `grow()`, and `shrink()` are implemented (they never return a larger allocation than requested), but that is a non-local property of the implementation, so it should be documented explicitly.
2025-02-25Auto merge of #137608 - fmease:rollup-h4siso6, r=fmeasebors-1/+1
Rollup of 8 pull requests Successful merges: - #137370 (adjust_abi: make fallback logic for ABIs a bit easier to read) - #137444 (Improve behavior of `IF_LET_RESCOPE` around temporaries and place expressions) - #137464 (Fix invalid suggestion from type error for derive macro) - #137539 ( Add rustdoc-gui regression test for #137082 ) - #137576 (Don't doc-comment BTreeMap<K, SetValZST, A>) - #137595 (remove `simd_fpow` and `simd_fpowi`) - #137600 (type_ir: remove redundant part of comment) - #137602 (feature: fix typo in attribute description) r? `@ghost` `@rustbot` modify labels: rollup