Commit Graph

289 Commits

Author SHA1 Message Date
Marijn Schouten
50398e2e75 iter repeat: add tests for new count and last behavior 2025-09-30 17:56:18 +00:00
bors
40ace17fc3 Auto merge of #145882 - m-ou-se:format-args-extend-1-arg, r=petrochenkov
Extended temporary argument to format_args!() in all cases

Fixes https://github.com/rust-lang/rust/issues/145880 by removing the special case.
2025-09-26 04:34:09 +00:00
Stuart Cook
cec668fefc Rollup merge of #146737 - RalfJung:f16-f128-miri, r=tgross35
f16_f128: enable some more tests in Miri

For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them.

I verified this with `./x miri library/core --no-doc -- float`.

r? `@tgross35`
2025-09-25 20:31:55 +10:00
Stuart Cook
8e62f95376 Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJung
unstably constify float mul_add methods

Tracking issue: rust-lang/rust#146724
r? `@tgross35`
2025-09-25 20:31:54 +10:00
Jeremy Smart
a00f24116e unstably constify float mul_add methods
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-24 15:21:31 -04:00
Ralf Jung
f509dff56d f16_f128: enable some more tests in Miri 2025-09-24 16:47:13 +02:00
Nathaniel McCallum
5dde557fc4 constify {float}::total_cmp() 2025-09-22 10:24:39 -04:00
Matthias Krüger
c0f5eefa27 Rollup merge of #146486 - ferrocene:pvdrz/improve-atomic-coverage, r=ibraheemdev
Improve `core::sync::atomic` coverage

This PR improves the `core::sync::atomic` coverage by adding new tests to `coretests`.

r? libs
2025-09-21 22:20:26 +02:00
Matthias Krüger
fd852f4bee Rollup merge of #146487 - ferrocene:pvdrz/improve-num-coverage, r=joboet
Improve `core::num` coverage

This PR improves the `core::num` coverage by adding a new test to `coretests`.

r? libs
2025-09-18 17:20:57 +02:00
Matthias Krüger
f4a522d1f8 Rollup merge of #146474 - ferrocene:pvdrz/improve-ascii-coverage, r=Noratrieb
Improve `core::ascii` coverage

This PR improves the `core::ascii` coverage by adding a new test to `coretests`

r? `@workingjubilee`
2025-09-16 20:42:22 +02:00
Christian Poveda
94d3a8cb91 Improve core::sync::atomic coverage 2025-09-16 10:26:52 -05:00
Christian Poveda
e652f97c6b Improve core::ascii coverage 2025-09-16 10:05:40 -05:00
Matthias Krüger
32c045ecd1 Rollup merge of #146488 - ferrocene:pvdrz/improve-ptr-coverage, r=Mark-Simulacrum
Improve `core::ptr` coverage

This PR improves the `core::ptr` coverage by adding a new test to `coretests` for the `<*const T>::is_aligned_to` method.

r? libs
2025-09-15 06:03:48 +02:00
Matthias Krüger
9070e95dda Rollup merge of #146478 - ferrocene:pvdrz/improve-fmt-coverage, r=Mark-Simulacrum
Improve `core::fmt` coverage

This PR improves the `core::fmt` coverage by adding new tests to `coretests`
2025-09-15 06:03:46 +02:00
Matthias Krüger
fa63dbf301 Rollup merge of #146284 - Kivooeo:blazing-fast-division-bignum, r=Mark-Simulacrum
Remove `div_rem` from `core::num::bignum`

This fixes very old fixme that sounds like this

```
Stupid slow base-2 long division taken from
https://en.wikipedia.org/wiki/Division_algorithm
FIXME use a greater base ($ty) for the long division.
```

By deleting this method since it was never used
2025-09-15 06:03:45 +02:00
Jana Dönszelmann
ec0f3bd2ed Rollup merge of #146481 - ferrocene:pvdrz/improve-hash-coverage, r=jhpratt
Improve `core::hash` coverage

This PR improves the `core::hash` coverage by adding a new test to `coretests` and extending one of the existing tests to use 128-bit integers

r? libs
2025-09-13 02:40:46 +02:00
Jana Dönszelmann
7928be014c Rollup merge of #146477 - ferrocene:pvdrz/improve-char-coverage, r=Noratrieb
Improve `core::char` coverage

This PR improves the `core::char` coverage by adding new tests to `coretests`

r? ``@workingjubilee``
2025-09-13 02:40:45 +02:00
Jana Dönszelmann
e4dbbbd322 Rollup merge of #146452 - ferrocene:pvdrz/improve-alloc-coverage, r=tgross35
Improve `alloc::Layout` coverage

This PR improves the `core::alloc` coverage by adding a new test to `coretests` that cover the `Layout` methods when they error.

Tracking issue: https://github.com/rust-lang/rust/issues/55724
2025-09-13 02:40:45 +02:00
Christian Poveda
87ae4dbf5c Improve core::ptr coverage 2025-09-12 14:41:26 -05:00
Christian Poveda
afe8f81c73 Improve core::num coverage 2025-09-12 14:35:20 -05:00
Christian Poveda
79643ad48a Improve core::hash coverage 2025-09-12 13:54:15 -05:00
Christian Poveda
2e652d7d13 Improve core::fmt coverage 2025-09-12 11:34:54 -05:00
Christian Poveda
51e3b6238d Improve core::char coverage 2025-09-12 11:22:07 -05:00
Christian Poveda
18059a0053 Improve core::alloc coverage 2025-09-12 10:49:52 -05:00
Evgenii Zheltonozhskii
ff9b1c1d28 Constify Eq, Ord, PartialOrd 2025-09-12 12:39:31 +03:00
Stuart Cook
5258dfc0b7 Rollup merge of #146425 - ferrocene:pvdrz/improve-array-coverage, r=workingjubilee
Improve `core::array` coverage

This PR improves the `core::array` coverage by adding new tests to `coretests`
2025-09-11 14:06:33 +10:00
Stuart Cook
81840271c3 Rollup merge of #146424 - ferrocene:pvdrz/improve-ops-coverage, r=workingjubilee
Improve `core::ops` coverage

This PR improves the `core::ops` coverage by adding new tests to `coretests`
2025-09-11 14:06:32 +10:00
Stuart Cook
c69a792137 Rollup merge of #146380 - rperier:unify_and_dedup_bits_conv_float_tests, r=tgross35
Unify and deduplicate bits conv float tests

cc rust-lang/rust#141726

This is a proposal to unify and deduplicate the bits conv tests for f16, f32, f64 and f128
2025-09-11 14:06:30 +10:00
Christian Poveda
a7528e7ec3 Improve core::array coverage 2025-09-10 17:25:24 -05:00
Christian Poveda Ruiz
789c8408ec Update library/coretests/tests/ops.rs
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-09-10 16:50:45 -05:00
Christian Poveda
5f2b04652f Improve core::ops coverage 2025-09-10 16:32:04 -05:00
Romain Perier
b1c4e19e13 Unify and deduplicate bits conv float tests 2025-09-10 14:25:36 +02:00
Ralf Jung
aed0ed4c93 const-eval: disable pointer fragment support 2025-09-08 13:22:52 +02:00
Kivooeo
a2d66db9ba remove unsused div_rem method from bignum 2025-09-07 17:21:47 +00:00
Trevor Gross
ebde667698 Rollup merge of #145940 - pascaldekloe:int-exp-tune, r=tgross35
single buffer for exponent fmt of integers

No need for fragmented buffers when formatting.

```
orig.txt: fmt::write_i128_exp                                                  143.39ns/iter      +/- 0.32
orig.txt: fmt::write_i64_exp                                                    68.72ns/iter      +/- 0.03
new.txt:  fmt::write_i128_exp                                                  138.29ns/iter      +/- 0.50
new.txt:  fmt::write_i64_exp                                                    58.93ns/iter      +/- 4.62
```

This patch fully eliminates unsafe pointer use (after rust-lang/rust#135265 and rust-lang/rust#136594).

    r? libs
2025-09-06 14:39:04 -04:00
Trevor Gross
db5cc29d4f Rollup merge of #146152 - rperier:unify_and_dedup_algebraic_float_tests, r=tgross35
Unify and deduplicate algebraic float tests

cc rust-lang/rust#141726

This is a proposal to unify and deduplicate the algebraic tests for f16, f32, f64 and f128
2025-09-05 01:53:21 -04:00
Jacob Pratt
00d5dc5c9d Rollup merge of #145690 - sayantn:integer-funnel-shift, r=tgross35
Implement Integer funnel shifts

Tracking issue: rust-lang/rust#145686
ACP: https://github.com/rust-lang/libs-team/issues/642

This implements funnel shifts on primitive integer types. Implements this for cg_llvm, with a fallback impl for everything else

Thanks `@folkertdev` for the fixes and tests

cc `@rust-lang/libs-api`
2025-09-04 01:43:21 -04:00
Stuart Cook
732802c207 Rollup merge of #143725 - kennytm:peekable_next_if_map, r=jhpratt
core: add Peekable::next_if_map

Implementation for rust-lang/rust#143702
2025-09-04 10:01:51 +10:00
Stuart Cook
f4b946a147 Rollup merge of #145279 - clarfonthey:const-convert-initial, r=tgross35
Constify conversion traits (part 1)

This is the first part of rust-lang/rust#144289 being split into smaller pieces. It adds/moves constness of several traits under the `const_convert` feature:

* `From`
* `Into`
* `TryFrom`
* `TryInto`
* `FromStr`
* `AsRef`
* `AsMut`
* `Borrow`
* `BorrowMut`
* `Deref`
* `DerefMut`

There are a few methods that are intrinsically tied to these traits which I've included in the feature. Particularly, those which are wrappers over `AsRef`:

* `ByteStr::new` (unstable under `bstr` feature)
* `OsStr::new`
* `Path::new`

Those which directly use `Into`:

* `Result::into_ok`
* `Result::into_err`

And those which use `Deref` and `DerefMut`:

* `Pin::as_ref`
* `Pin::as_mut`
* `Pin::as_deref_mut`
* `Option::as_deref`
* `Option::as_deref_mut`
* `Result::as_deref`
* `Result::as_deref_mut`

(note: the `Option` and `Result` methods were suggested by ``@npmccallum`` initially as rust-lang/rust#146101)

The parts which are missing from this PR are:

* Anything that involves heap-allocated types
* Making any method const than the ones listed above
* Anything that could rely on the above, *or* could rely on system-specific code for `OsStr` or `Path` (note: this mostly makes these methods useless since `str` doesn't implement `AsRef<OsStr>` yet, but it's better to track the method for now and add impls later, IMHO)

r? ``@tgross35`` (who mostly already reviewed this)
2025-09-03 23:08:06 +10:00
Romain Perier
4e872375d4 Unify and deduplicate algebraic float tests 2025-09-03 14:39:50 +02:00
sayantn
62b4347e80 Add funnel_sh{l,r} functions and intrinsics
- Add a fallback implementation for the intrinsics
 - Add LLVM backend support for funnel shifts

Co-Authored-By: folkertdev <folkert@folkertdev.nl>
2025-09-03 14:13:24 +05:30
ltdk
1c64d3e6d1 Constify conversion traits 2025-09-01 21:38:26 -04:00
Stuart Cook
1d520e2694 Rollup merge of #145468 - karolzwolak:float-tests-dedup, r=tgross35
dedup recip, powi, to_degrees, and to_radians float tests

Deduplicates recip, powi, to_degrees, and to_radians float tests.
I had to fiddle and slightly increase the tolerances for a few comparisons, so maybe not all of the tests are worth deduplicating.

Part of rust-lang/rust#141726.
Best reviewed commit-by-commit.

r? `@tgross35`
2025-09-01 17:35:02 +10:00
Karol Zwolak
9028efcf2e dedup to_radians float test 2025-08-31 18:20:49 +02:00
Karol Zwolak
c81a8a89ee dedup to_degrees float test 2025-08-31 18:19:05 +02:00
Karol Zwolak
e10e6d78ac dedup powi float test 2025-08-31 18:16:00 +02:00
Matthias Krüger
59a645ac25 Rollup merge of #145174 - 197g:issue-145148-select-unpredictable-drop, r=joboet
Ensure consistent drop for panicking drop in hint::select_unpredictable

There are a few alternatives to the implementation. The principal problem is that the selected value must be owned (in the sense of having a drop flag of sorts) when the unselected value is dropped, such that panic unwind goes through the drop of both. This ownership must then be passed on in return when the drop went smoothly.

The basic way of achieving this is by extracting the selected value first, at the cost of relying on the optimizer a little more for detecting the copy as constructing the return value despite having a place in the body. Unfortunately, that causes LLVM to discard the !unpredictable annotation (for some reason that is beyond my comprehension of LLVM).

<details>
<summary>Extract from the build log showing an unannotated select being used</summary>

```
2025-08-09T16:51:06.8790764Z            39: define noundef i64 `@test_int2(i1` noundef zeroext %p, i64 noundef %a, i64 noundef %b) unnamed_addr #0 personality ptr `@rust_eh_personality` {
2025-08-09T16:51:06.8791368Z check:47'0                                  X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
2025-08-09T16:51:06.8791700Z            40: start:
2025-08-09T16:51:06.8791858Z check:47'0     ~~~~~~~
2025-08-09T16:51:06.8792043Z            41:  %ret.i = select i1 %p, i64 %a, i64 %b
2025-08-09T16:51:06.8792293Z check:47'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-08-09T16:51:06.8792686Z check:47'1               ?                             possible intended match
2025-08-09T16:51:06.8792946Z            42:  ret i64 %ret.i
2025-08-09T16:51:06.8793127Z check:47'0     ~~~~~~~~~~~~~~~~
```

</details>

So instead, this PR includes a guard to drop the selected `MaybeUnit<T>` which is active only for the section where the unselected value is dropped. That leaves the code for selecting the result intact leading to the expected ir. That complicates the 'unselection' process a little bit since we require _both_ values as a result of that intrinsic call. Since the arguments alias, this portion as well as the drop guard uses raw pointers.

Closes: rust-lang/rust#145148
Prior: rust-lang/rust#139977
2025-08-31 13:40:35 +02:00
Karol Zwolak
6ebd009d47 dedup recip float test
I left the additional asserts on {f16, f128}::MAX.recip() in a new
test_max_recip tests.
2025-08-30 14:54:41 +02:00
Aurelia Molzer
539f8400e7 Clarify panic-drop test for select_unpredictable 2025-08-30 13:01:32 +02:00
Stuart Cook
f655e6a863 Rollup merge of #145969 - actuallylost:duration-from-nanos-128, r=tgross35
Add Duration::from_nanos_u128

Feature Gate: `#![feature(duration_from_nanos_u128)]`
ACP: https://github.com/rust-lang/libs-team/issues/567
Tracking issue: https://github.com/rust-lang/rust/issues/139201
Recreated from https://github.com/rust-lang/rust/pull/139243
2025-08-30 20:29:08 +10:00