about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-05-15Rollup merge of #140990 - biabbas:vxworks, r=tgross35Matthias Krüger-12/+3
VxWorks: updates from recent libc versions Vxworks changes. Required changes were added to libc in pr https://github.com/rust-lang/libc/pull/4407 and https://github.com/rust-lang/libc/pull/4337
2025-05-15Rollup merge of #140685 - viliml:patch-1, r=Mark-SimulacrumMatthias Krüger-4/+4
Simplify `Vec::as_non_null` implementation and make it `const` Tracking issue: #130364.
2025-05-15Rollup merge of #139749 - ↵Matthias Krüger-5/+5
ruancomelli:docs/library/core/src/pin/fix-typo-necessarily-to-necessary, r=joboet docs(library/core/src/pin): fix typo "necessarily" -> "necessary" Fix a typo in [`library/core/src/pin.rs`](https://github.com/ruancomelli/rust/blob/14662fabeb69fe5ab6c6e68051bf9f80d4aaaa35/library/core/src/pin.rs), from > As we'll see later, this is **necessarily** from the time the value is first pinned until the end of its lifespan. to > As we'll see later, this is **necessary** from the time the value is first pinned until the end of its lifespan. (my emphasis).
2025-05-15Auto merge of #136264 - GuillaumeGomez:optimize-integers-to-string, r=Amanieubors-9/+67
Optimize `ToString` implementation for integers Part of https://github.com/rust-lang/rust/issues/135543. Follow-up of https://github.com/rust-lang/rust/pull/133247 and https://github.com/rust-lang/rust/pull/128204. The benchmark results are: | name| 1.87.0-nightly (3ea711f17 2025-03-09) | With this PR | diff | |-|-|-|-| | bench_i16 | 32.06 ns/iter (+/- 0.12) | 17.62 ns/iter (+/- 0.03) | -45% | | bench_i32 | 31.61 ns/iter (+/- 0.04) | 15.10 ns/iter (+/- 0.06) | -52% | | bench_i64 | 31.71 ns/iter (+/- 0.07) | 15.02 ns/iter (+/- 0.20) | -52% | | bench_i8 | 13.21 ns/iter (+/- 0.14) | 14.93 ns/iter (+/- 0.16) | +13% | | bench_u16 | 31.20 ns/iter (+/- 0.06) | 16.14 ns/iter (+/- 0.11) | -48% | | bench_u32 | 33.27 ns/iter (+/- 0.05) | 16.18 ns/iter (+/- 0.10) | -51% | | bench_u64 | 31.44 ns/iter (+/- 0.06) | 16.62 ns/iter (+/- 0.21) | -47% | | bench_u8 | 10.57 ns/iter (+/- 0.30) | 13.00 ns/iter (+/- 0.43) | +22% | More information about it in [the original comment](https://github.com/rust-lang/rust/pull/136264#discussion_r1987542954). r? `@workingjubilee`
2025-05-15improve internal fastfail explainerjoboet-3/+2
2025-05-15deduplicate abort implementationsjoboet-117/+43
Currently, the code for process aborts is duplicated across `panic_abort` and `std`. This PR uses `#[rustc_std_internal_symbol]` to make the `std` implementation available to `panic_abort` via the linker, thereby deduplicating the code.
2025-05-14Update std doctests for androidEric Huss-6/+21
This updates some doctests that fail to run on android. We will soon be supporting cross-compiled doctests, and the `arm-android` job fails to run these tests. In summary: - Android re-exports some traits from linux under a different path. - Android doesn't seem to have common unix utilities like `true`, `false`, or `whoami`, so these are disabled.
2025-05-15Fix confusing WTF surrogate safety docsteor-6/+6
2025-05-14wire up startupinfo methodsFederico Terzi-0/+72
2025-05-14Rollup merge of #140988 - mathisbot:docfix_maybeuninit_write, r=tgross35Matthias Krüger-1/+1
MaybeUninit::write: fix doc # Fix doc for `MaybeUninit::write` The documentation refers to the way `MaybeUninit` stores data internally. The property of not dropping content on context exit is the responsibility of `ManuallyDrop`.
2025-05-14Skip {f32,f64}::mul_add tests on MinGWTrevor Gross-0/+10
Per [1], MinGW has an incorrect fma implementation. This showed up in tests run with cranelift after adding float math operations to `core`. Presumably we hadn't noticed this when running tests with LLVM because LLVM was constant folding the result away. Rust issue: https://github.com/rust-lang/rust/issues/140515 [1]: https://sourceforge.net/p/mingw-w64/bugs/848/
2025-05-14Move applicable float tests from `coretests` back to `std`Trevor Gross-1173/+1314
The previous commit moved all test files from `std` to `core` so git understands the move. Not all functionality is actually testable in `core`, however, so perform move the relevant portions back. Changes from inherent to module methods is also done since this is the form of math operations available in `core` (as `core_float_math`).
2025-05-14Fix settimes for vxworksB I Mohammed Abbas-2/+1
2025-05-14Fix set_name for vxworks. Length of name should be truncated to ↵B I Mohammed Abbas-10/+2
VX_TASK_RENAME_LENGTH-1
2025-05-14Add `Ipv4Addr` and `Ipv6Addr` diagnostic itemsSamuel Tardieu-0/+2
They will be used in Clippy to detect runtime parsing of known-valid IP addresses.
2025-05-14MaybeUninit::write: fix docMathis Bottinelli-1/+1
2025-05-13fix doc for UnixStreamMichał Łowicki-2/+2
2025-05-13Move float tests from std to coreTrevor Gross-0/+12
Many float-related tests in `std` only depend on `core`, so move the tests there. This also allows us to verify functions from `core_float_math`. Since the majority of test files need to be moved to `coretests`, move the files here without any cleanup; this is done in a followup commit. This makes git history slightly cleaner, but coretests will not build immediately after this commit.
2025-05-13Initial implementation of `core_float_math`Trevor Gross-869/+1713
Since [1], `compiler-builtins` makes a certain set of math symbols weakly available on all platforms. This means we can begin exposing some of the related functions in `core`, so begin this process here. It is not possible to provide inherent methods in both `core` and `std` while giving them different stability gates, so standalone functions are added instead. This provides a way to experiment with the functionality while unstable; once it is time to stabilize, they can be converted to inherent. For `f16` and `f128`, everything is unstable so we can move the inherent methods. The following are included to start: * floor * ceil * round * round_ties_even * trunc * fract * mul_add * div_euclid * rem_euclid * powi * sqrt * abs_sub * cbrt These mirror the set of functions that we have in `compiler-builtins` since [1]. Tracking issue: https://github.com/rust-lang/rust/issues/137578 [1]: https://github.com/rust-lang/compiler-builtins/pull/763
2025-05-13`impl PartialEq<{str,String}> for {Path,PathBuf}`Martin Habovstiak-0/+65
Comparison of paths and strings is expected to be possible and needed e.g. in tests. This change adds the impls os `PartialEq` between strings and paths, both owned and unsized, in both directions. ACP: https://github.com/rust-lang/libs-team/issues/151
2025-05-13Fix `i256::MAX`Tobias Decking-2/+2
2025-05-13Format and skip formatting for pinMichael Goulet-0/+2
2025-05-13bump compiler_builtinsPietro Albini-4/+4
2025-05-13Add `#[must_use]` to Array::mapJulian Knodt-1/+2
The output of Array::map is intended to be an array of the same size, and does not modify the original in place nor is it intended for side-effects. Thus, under normal circumstances it should be consumed. See [discussion](https://internals.rust-lang.org/t/array-map-annotate-with-must-use/22813/26). Attaching to tracking issue #75243
2025-05-12Partially stabilize LoongArch target featuresWANG Rui-11/+10
2025-05-12Specify that split_ascii_whitespace uses the same definition as ↵Simon Sapin-1/+3
is_ascii_whitespace
2025-05-12chore(compiler_builtins): release v0.1.159github-actions[bot]-1/+7
2025-05-12Remove cfg(bootstrap)nora-12/+0
Foe the bootstrap bump
2025-05-12manual clippy fixesPietro Albini-0/+1
2025-05-12update cfg(bootstrap)Pietro Albini-408/+216
2025-05-12update version placeholdersPietro Albini-44/+44
2025-05-11Make some `f32`/`f64` tests also run in const-contextUrgau-143/+189
2025-05-11Rollup merge of #140882 - Dietr1ch:dev/duration_constructors_lite, r=BurntSushiLeón Orell Valerian Liehr-5/+15
Split duration_constructors to get non-controversial constructors out This implements #140881
2025-05-11Rollup merge of #140792 - Urgau:minimum-maximum-intrinsics, ↵León Orell Valerian Liehr-84/+180
r=scottmcm,traviscross,tgross35 Use intrinsics for `{f16,f32,f64,f128}::{minimum,maximum}` operations This PR creates intrinsics for `{f16,f32,f64,f64}::{minimum,maximum}` operations. This wasn't done when those operations were added as the LLVM support was too weak but now that LLVM has libcalls for unsupported platforms we can finally use them. Cranelift and GCC[^1] support are partial, Cranelift doesn't support `f16` and `f128`, while GCC doesn't support `f16`. r? `@tgross35` try-job: aarch64-gnu try-job: dist-various-1 try-job: dist-various-2 [^1]: https://www.gnu.org/software///gnulib/manual/html_node/Functions-in-_003cmath_002eh_003e.html
2025-05-10Remove `stable` attribute from wasi fs (read_exact|write_all)_atPaolo Barbolini-2/+0
2025-05-10Rollup merge of #140789 - hermit-os:hermit-abi-0.5.1, r=Mark-SimulacrumMatthias Krüger-2/+2
Update hermit-abi to 0.5.1 This updates hermit-abi to version 0.5.1, bringing the [recent `AF_*`](https://github.com/rust-lang/libc/pull/4344) changes to std.
2025-05-10Rollup merge of #140783 - veluca93:oncelock-docs, r=jhprattMatthias Krüger-1/+1
Update documentation of OnceLock::get_or_init. Explicitly point out that if the function panics the init function might be called multiple times.
2025-05-10Rollup merge of #140660 - RalfJung:more-order, r=WaffleLapkinMatthias Krüger-12/+0
remove 'unordered' atomic intrinsics As their doc comment already indicates, these operations do not currently have a place in our memory model. The intrinsics were introduced to support a hack in compiler-builtins, but that hack recently got removed (see https://github.com/rust-lang/compiler-builtins/issues/788).
2025-05-10Rollup merge of #140151 - RalfJung:drop_in_place-is-not-an-intrinsic, ↵Matthias Krüger-9/+0
r=Mark-Simulacrum remove intrinsics::drop_in_place This was only ever accidentally stable, and has been marked as deprecated since Rust 1.52, released almost 4 years ago. We've removed the old serialization `derive`s, maybe we can remove this one as well? As suggested by ``@jhpratt,`` let's see what crater says for this one.
2025-05-10Rollup merge of #129334 - ChayimFriedman2:more-lazy-methods, r=AmanieuMatthias Krüger-2/+18
Implement (part of) ACP 429: add `DerefMut` to `Lazy[Cell/Lock]` `DerefMut` is instantly stable, as a trait impl. That means this needs an FCP. ``@rustbot`` label +needs-fcp https://github.com/rust-lang/libs-team/issues/429
2025-05-09Split duration_constructors to get non-controversial bits out faster.Dietrich Daroch-5/+15
2025-05-09Add intrinsic fallback for `{minimum,maximum}{16,32,64,128}`Urgau-164/+108
2025-05-09remove 'unordered' atomic intrinsicsRalf Jung-12/+0
2025-05-09Use intrinsics for `{f16,f32,f64,f128}::{minimum,maximum}` operationsUrgau-76/+228
2025-05-08Rollup merge of #140341 - saethlin:black-box-qoi, r=Mark-SimulacrumMatthias Krüger-0/+4
Clarify black_box warning a bit Trying to bring the docs on black_box more in line with the advice that we have discussed in Zulip. https://github.com/rust-lang/rust/pull/140341#issuecomment-2832592382
2025-05-08Indicate that the warning on black_box is a general property of RustBen Kimock-0/+4
And note that the same limitation applies to all LLVM-based compilers Co-authored-by: Ralf Jung <post@ralfj.de>
2025-05-08Rollup merge of #140759 - dpaoliello:symlink, r=workingjubileeMatthias Krüger-0/+16
[win][arm64] Disable std::fs tests that require symlinks While trying to get the aarch64-msvc build working correctly (#140136), various tests in `std::fs` were failing as the Arm64 Windows runner image we are using does not have Developer Mode enabled, thus it cannot create symlinks. I've [filed a request to get Developer Mode enabled](https://github.com/actions/partner-runner-images/issues/94), but in the meantime I've disabled the relevant tests on Arm64 Windows.
2025-05-08std: Explain prefer `TryInto` over `TryFrom` when specifying traits bounds ↵xizheyin-0/+6
on generic function Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-08std: Make consistence between `From` and `Into`xizheyin-2/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-08Update documentation of OnceLock::get_or_init.Luca Versari-1/+1
Explicitly point out that if the function panics the init function might be called multiple times.