about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-01-04Rollup merge of #135110 - matthiaskrgr:adler, r=workingjubileeJubilee-1/+1
library: fix adler{ -> 2}.debug Fixes ``` Checking stage0 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-unknown-linux-gnu) warning: profile package spec `adler` in profile `release` did not match any packages Did you mean `adler2`? ``` r? `@bjorn3`
2025-01-04Rollup merge of #135104 - the8472:disable-in-place-iter-for-flatten, ↵Jubilee-51/+22
r=Mark-Simulacrum do not in-place-iterate over flatmap/flatten The implementation is unsound when a partially consumed iterator has some elements buffered in the front/back parts and cloning the Iterator removes the capacity from the backing vec::IntoIter. This is a fix for #135103 that removes the specialization trait impls without removing some supporting parts. I've kept it small so it can be easily backported. I'll either remove the remaining parts or think of a way to recover the optimization in a separate PR.
2025-01-04Rollup merge of #134996 - bdbai:uwp-support, r=jieyouxu,ChrisDentonJubilee-2/+3
Add UWP (msvc) target support page - Added Platform Support page for `x86_64-uwp-windows-msvc`, `i686-uwp-windows-msvc`, `thumbv7a-uwp-windows-msvc` and `aarch64-uwp-windows-msvc` - Adding myself as a maintainer - Removing the ticks for `thumbv7a-pc-windows-msvc` and `thumbv7a-uwp-windows-msvc` as they do not currently build due to #134565 and https://github.com/rust-lang/backtrace-rs/pull/685 - Fixed a few minor issues to let most of the UWP targets compile - Happy new year to all! r? jieyouxu
2025-01-05Add doc aliases for `libm` and IEEE namesTrevor Gross-0/+8
Searching "fma" in the Rust documentation returns results for `intrinsics::fma*`, but does not point to the user-facing `mul_add`. Add aliases for `fma*` and the IEEE operation name `fusedMultiplyAdd`. Add the IEEE name to `sqrt` as well, `squareRoot`.
2025-01-05library: fix adler{-> 2}.debugMatthias Krüger-1/+1
Fixes ``` Checking stage0 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-unknown-linux-gnu) warning: profile package spec `adler` in profile `release` did not match any packages Did you mean `adler2`? ```
2025-01-04add regression test for unsound Flatten/FlatMap specializationThe 8472-0/+14
2025-01-04do not in-place-iterate over flatmap/flattenThe 8472-51/+8
The implementation is unsound when a partially consumed iterator has some elements buffered in the front/back parts and cloning the Iterator removes the capacity from the backing vec::IntoIter.
2025-01-04Rollup merge of #135091 - workingjubilee:backtrace-0.3.75, r=workingjubileeJubilee-0/+0
Bump backtrace to 0.3.75 I prefer when we can ship the same version of backtrace on crates.io, and this will be the next published version. Compare: https://github.com/rust-lang/backtrace-rs/compare/4d7906b...0.3.75 Mostly internal-to-backtrace changes, plus a tiny code size win. r? `@ghost`
2025-01-04Rollup merge of #135070 - klensy:backtrace-deps, r=workingjubileeJubilee-23/+12
std: sync to dep versions of backtrace Minor versions from backtrace desynced with std (they still differs in patch numbers, but still better): https://github.com/rust-lang/backtrace-rs/blob/4d7906bb24ae91ee6587127020d360f5298f9e7e/Cargo.toml#L44-L48 There is hidden bug here, let's see if CI can find it. cc `@workingjubilee`
2025-01-04Rollup merge of #135046 - RalfJung:rustc_box_intrinsic, r=compiler-errorsJubilee-6/+26
turn rustc_box into an intrinsic I am not entirely sure why this was made a special magic attribute, but an intrinsic seems like a more natural way to add magic expressions to the language.
2025-01-04precision: Sort `ilogb` with other precise operationsTrevor Gross-1/+1
This is a nonfunctional change.
2025-01-04Rollup merge of #133964 - joboet:select_unpredictable, r=tgross35Matthias Krüger-3/+51
core: implement `bool::select_unpredictable` Tracking issue: #133962 ACP: https://github.com/rust-lang/libs-team/issues/468
2025-01-03Bump backtrace to 0.3.75Jubilee Young-0/+0
I prefer when we can ship the same version of backtrace on crates.io, and this will be the next published version. Compare: https://github.com/rust-lang/backtrace-rs/compare/4d7906b...0.3.75 Mostly internal-to-backtrace changes, plus a tiny code size win.
2025-01-03Change to exhaustive matching for `default_ulp`Trevor Gross-39/+91
Make it more obvious what the expected ULP for a given routine is. This also narrows ULP to 0 for operations that require exact results.
2025-01-03Rollup merge of #133420 - thesummer:rtems-unwind, r=workingjubileeMatthias Krüger-3/+2
Switch rtems target to panic unwind Switch the RTEMS target to `panic_unwind`. Relates to https://github.com/rust-lang/backtrace-rs/pull/682
2025-01-03Use intrinsics for `abs` and `copysign` when availableTrevor Gross-16/+43
Currently our implementations for `abs` and `copysign` are defined on the trait, and these are then called from `generic`. It would be better to call core's `.abs()` / `.copysign(y)`, but we can't do this in the generic because calling the standalone function could become recursive (`fabsf` becomes `intrinsics::fabsf32`, that may lower to a call to `fabsf`). Change this so the traits uses the call to `core` if available, falling back to a call to the standalone generic function. In practice the recursion isn't likely to be a problem since LLVM probably always lowers `abs`/`copysign` to assembly, but this pattern should be more correct for functions that we will add in the future (e.g. `fma`). This should eventually be followed by a change to call the trait methods rather than `fabs`/`copysign` directly.
2025-01-03sync to actual dep verions of backtraceklensy-23/+12
2025-01-03turn rustc_box into an intrinsicRalf Jung-6/+26
2025-01-03Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgrbors-1/+1
Rollup of 4 pull requests Successful merges: - #131729 (Make the `test` cfg a userspace check-cfg) - #134241 (more concrete source url of std docs [V2]) - #135042 (taint fcx on selection errors during unsizing) - #135049 (Remove unused fields from RepeatElementCopy obligation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-03Rollup merge of #134241 - liigo:patch-16, r=dtolnayMatthias Krüger-1/+1
more concrete source url of std docs [V2] r? jhpratt since you have reivewed https://github.com/rust-lang/rust/pull/134193 > If someone is looking to contribute, they will want the repository as a whole, not the lib.rs for std. Now the repository url is reserved, I just add another concrete url as an example, to help people finding target page more quickly&easily.
2025-01-03Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35bors-27/+131
Move some things to `std::sync::poison` and reexport them in `std::sync` Tracking issue: #134646 r? `@tgross35` I've used `sync_poison_mod` feature flag instead, because `sync_poison` had already been used back in 1.2. try-job: x86_64-msvc
2025-01-03Fix UWP buildbdbai-2/+3
2025-01-03Fix new `clippy::precedence` errorsTrevor Gross-13/+13
`clippy::precedence` now applies to bitwise `&` and `|`. Update with all of its suggestions, including a separate elided lifetime suggestion.
2025-01-03Rename `EXP_MAX` to `EXP_SAT`Trevor Gross-8/+11
"Maximum" is technically correct here with regards to what the bitpattern can represent, but it is not the numeric maximum value of the exponent which has a relationship with the bias. So, replace the maximum terminology with "saturated" to indicate it only means the full bitpattern. This change is more relevant to `libm` than `compiler-builtins`.
2025-01-03Shorten prefixes for float constantsTrevor Gross-116/+111
Change `SIGNIFICAND_*` to `SIG_*` and `EXPONENT_*` to `EXP_*`. This makes things more consistent with `libm`, and terseness is convenient here since there isn't anything to confuse.
2025-01-02Bump backtrace to rust-lang/backtrace-rs@4d7906bJubilee Young-0/+0
Compare: https://github.com/rust-lang/backtrace-rs/compare/230570f...4d7906b Mostly cleanups and enabling backtraces for the RTEMS target.
2025-01-02Rename generic `abs` to `fabs`Trevor Gross-5/+5
Using the same name as the routines themselves means this will correctly get picked up by the CI job looking for exhaustive tests.
2025-01-02macros: Always emit `f16_enabled` and `f128_enabled` attributesTrevor Gross-20/+57
Once we start addinf `f16` and `f128` routines, we will need to have this cfg for almost all uses of `for_each_function`. Rather than needing to specify this each time, always emit `#[cfg(f16_enabled)]` or `#[cfg(f128_enabled)]` for each function that uses `f16` or `f128`, respectively.
2025-01-02Auto merge of #122565 - Zoxc:atomic-panic-msg, r=the8472bors-1/+17
Try to write the panic message with a single `write_all` call This writes the panic message to a buffer before writing to stderr. This allows it to be printed with a single `write_all` call, preventing it from being interleaved with other outputs. It also adds newlines before and after the message ensuring that only the panic message will have its own lines. Before: ``` thread 'thread 'thread 'thread 'thread '<unnamed>thread 'thread 'thread 'thread '<unnamed><unnamed>thread '<unnamed>' panicked at ' panicked at <unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at <unnamed>' panicked at src\heap.rssrc\heap.rs' panicked at ' panicked at ' panicked at ' panicked at ' panicked at src\heap.rs' panicked at src\heap.rs::src\heap.rssrc\heap.rssrc\heap.rssrc\heap.rssrc\heap.rs:src\heap.rs:455455:::::455:455::455455455455455:455:99:::::9:9: : 999: 999: assertion failed: size <= (*queue).block_size: : assertion failed: size <= (*queue).block_size: assertion failed: size <= (*queue).block_size: : : assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeerror: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` After: ``` thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size error: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` --- try-jobs: x86_64-gnu-llvm-18
2025-01-02path in detailLiigo Zhuang-1/+1
2025-01-02Move some things to `std::sync::poison` and reexport them in `std::sync`Pavel Grigorenko-27/+131
2025-01-02fix doc for missing Box allocator consistencyLemonJ-0/+3
2025-01-01Auto merge of #135005 - matthiaskrgr:rollup-5ubuitt, r=matthiaskrgrbors-1/+1
Rollup of 5 pull requests Successful merges: - #134967 (handle submodules automatically on `doc` steps) - #134973 (Fix typos) - #134984 (`ObligationCause` construction tweaks in typeck) - #134985 (Remove qualification of `std::cmp::Ordering` in `Ord` doc) - #135000 (Fix ICE when opaque captures a duplicated/invalid lifetime) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-01Rollup merge of #134985 - ↵Matthias Krüger-1/+1
mgsloan:remove-unnecessary-qualification-in-Ord-trait-docs, r=Noratrieb Remove qualification of `std::cmp::Ordering` in `Ord` doc
2025-01-01Rename the internal simpler `quote` macro to `minimal_quote`Asuna-24/+24
2025-01-01Auto merge of #134080 - kleisauke:avoid-lfs64-emscripten, r=Noratriebbors-17/+3
Avoid use of LFS64 symbols on Emscripten Since Emscripten uses musl libc internally. Non-functional change: all LFS64 symbols were aliased to their non-LFS64 counterparts in rust-lang/libc@7c952dceaad4cdc35e00884fcb12a713d41a87e0.
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-1/+17
2025-01-01Stabilize const_slice_flattenDaniPopes-2/+2
Const-stabilizes `slice::as_flattened{,_mut}`: ```rust // core::slice impl<T, const N: usize> [[T; N]] { pub const fn as_flattened(&self) -> &[T]; pub const fn as_flattened_mut(&mut self) -> &mut [T]; } ``` Tracking issue: https://github.com/rust-lang/rust/issues/95629 Requires separate libs-api FCP, as per https://github.com/rust-lang/rust/issues/95629#issuecomment-2566546257. Closes https://github.com/rust-lang/rust/issues/95629.
2025-01-01std::fs::DirEntry.metadata(): prefer use of lstat() on EmscriptenKleis Auke Wolthuizen-8/+1
Align it with musl, which also prefers using lstat() here.
2025-01-01Avoid use of LFS64 symbols on EmscriptenKleis Auke Wolthuizen-9/+2
Since Emscripten uses musl libc internally. Non-functional change: all LFS64 symbols were aliased to their non-LFS64 counterparts in rust-lang/libc@7c952dceaad4cdc35e00884fcb12a713d41a87e0.
2025-01-01Add missing functions to the macro listTrevor Gross-19/+42
Now that we are using rustdoc output to locate public functions, the test is indicating a few that were missed since they don't have their own function. Update everything to now include the following routines: * `erfc` * `erfcf` * `y0` * `y0f` * `y1` * `y1f` * `yn` * `ynf`
2025-01-01Use `rustdoc` output to create a list of public APITrevor Gross-69/+283
Rather than collecting a list of file names in `libm-test/build.rs`, just use a script to parse rustdoc's JSON output.
2025-01-01Forward the `CI` environment variable when running in DockerTrevor Gross-0/+1
We want to be able to adjust our configuration based on whether we are running in CI, propagate this so our tests can use it.
2025-01-01Auto merge of #134969 - Marcondiro:master, r=jhpratt,programmerjakebors-7/+11
char to_digit: avoid unnecessary casts to u64 Hello, in the `char::to_digit` method there are a few `as u64` casts that are not strictly necessary. I assume that the reason behind these casts is to avoid possible overflows in the `+ 10` add. This PR removes the aforementioned casts, avoiding the overflow issue by slightly modifying the ASCII letter to int mapping. Thanks, Happy new year.
2025-01-01Rollup merge of #131439 - mu001999-contrib:cleanup/static-mut, r=estebankStuart Cook-2/+0
Remove allowing static_mut_refs lint
2024-12-31Improve `select_nth_unstable` documentation clarityMichael Sloan-42/+40
* Instead uses `before` and `after` variable names in the example where `greater` and `lesser` are flipped. * Uses `<=` and `>=` instead of "less than or equal to" and "greater than or equal to" to make the docs more concise. * General attempt to remove unnecessary words and be more precise. For example it seems slightly wrong to say "its final sorted position", since this implies there is only one sorted position for this element.
2024-12-31Remove qualification of `std::cmp::Ordering` in `Ord` docMichael Sloan-1/+1
2024-12-31Auto merge of #132195 - clarfonthey:bigint-mul, r=scottmcmbors-123/+388
Tidy up bigint multiplication methods This tidies up the library version of the bigint multiplication methods after the addition of the intrinsics in #133663. It follows [this summary](https://github.com/rust-lang/rust/issues/85532#issuecomment-2403442775) of what's desired for these methods. Note that, if `2H = N`, then `uH::MAX * uH::MAX + uH::MAX + uH::MAX` is `uN::MAX`, and that we can effectively add two "carry" values without overflowing. For ease of terminology, the "low-order" or "least significant" or "wrapping" half of multiplication will be called the low part, and the "high-order" or "most significant" or "overflowing" half of multiplication will be called the high part. In all cases, the return convention is `(low, high)` and left unchanged by this PR, to be litigated later. ## API Changes The original API: ```rust impl uN { // computes self * rhs pub const fn widening_mul(self, rhs: uN) -> (uN, uN); // computes self * rhs + carry pub const fn carrying_mul(self, rhs: uN, carry: uN) -> (uN, uN); } ``` The added API: ```rust impl uN { // computes self * rhs + carry1 + carry2 pub const fn carrying2_mul(self, rhs: uN, carry: uN, add: uN) -> (uN, uN); } impl iN { // note that the low part is unsigned pub const fn widening_mul(self, rhs: iN) -> (uN, iN); pub const fn carrying_mul(self, rhs: iN, carry: iN) -> (uN, iN); pub const fn carrying_mul_add(self, rhs: iN, carry: iN, add: iN) -> (uN, iN); } ``` Additionally, a naive implementation has been added for `u128` and `i128` since there are no double-wide types for those. Eventually, an intrinsic will be added to make these more efficient, but rather than doing this all at once, the library changes are added first. ## Justifications for API The unsigned parts are done to ensure consistency with overflowing addition: for a two's complement integer, you want to have unsigned overflow semantics for all parts of the integer except the highest one. This is because overflow for unsigned integers happens on the highest bit (from `MAX` to zero), whereas overflow for signed integers happens on the second highest bit (from `MAX` to `MIN`). Since the sign information only matters in the highest part, we use unsigned overflow for everything but that part. There is still discussion on the merits of signed bigint *addition* methods, since getting the behaviour right is very subtle, but at least for signed bigint *multiplication*, the sign of the operands does make a difference. So, it feels appropriate that at least until we've nailed down the final API, there should be an option to do signed versions of these methods. Additionally, while it's unclear whether we need all three versions of bigint multiplication (widening, carrying-1, and carrying-2), since it's possible to have up to two carries without overflow, there should at least be a method to allow that. We could potentially only offer the carry-2 method and expect that adding zero carries afterword will optimise correctly, but again, this can be litigated before stabilisation. ## Note on documentation While a lot of care was put into the documentation for the `widening_mul` and `carrying_mul` methods on unsigned integers, I have not taken this same care for `carrying_mul_add` or the signed versions. While I have updated the doc tests to be more appropriate, there will likely be many documentation changes done before stabilisation. ## Note on tests Alongside this change, I've added several tests to ensure that these methods work as expected. These are alongside the codegen tests for the intrinsics.
2024-12-31Auto merge of #134966 - matthiaskrgr:rollup-lmhmgsv, r=matthiaskrgrbors-4/+0
Rollup of 4 pull requests Successful merges: - #134610 (Format `build.toml` consistently in platform support docs) - #134918 (Windows: Enable issue 70093 link tests) - #134953 (Fix doc for read&write unaligned in zst operation) - #134956 (Account for C string literals and `format_args` in `HiddenUnicodeCodepoints` lint) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-31char to_digit: avoid unnecessary casts to u64Marcondiro-7/+11