Commit Graph

297 Commits

Author SHA1 Message Date
Jieyou Xu 4aeb297064 Revert "unicode_data refactors RUST-147622"
This PR reverts RUST-147622 for several reasons:

1. The RUST-147622 PR would format the generated core library code using
   an arbitrary `rustfmt` picked up from `PATH`, which will cause
   hard-to-debug failures when the `rustfmt` used to format the
   generated unicode data code versus the `rustfmt` used to format the
   in-tree library code.
2. Previously, the `unicode-table-generator` tests were not run under CI
   as part of `coretests`, and since for `x86_64-gnu-aux` job we run
   library `coretests` with `miri`, the generated tests unfortunately
   caused an unacceptably large Merge CI time regression from ~2 hours
   to ~3.5 hours, making it the slowest Merge CI job (and thus the new
   bottleneck).
3. This PR also has an unintended effect of causing a diagnostic
   regression (RUST-148387), though that's mostly an edge case not
   properly handled by `rustc` diagnostics.

Given that these are three distinct causes with non-trivial fixes, I'm
proposing to revert this PR to return us to baseline. This is not
prejudice against relanding the changes with these issues addressed, but
to alleviate time pressure to address these non-trivial issues.
2025-11-03 19:53:11 +08:00
Matthias Krüger 01ab3e369b Rollup merge of #146260 - Qelxiros:146179-sliceindex-wrappers, r=jhpratt
add SliceIndex wrapper types Last and Clamp<Idx>

Tracking issue: rust-lang/rust#146179
2025-11-03 06:54:35 +01:00
bors 73e6c9ebd9 Auto merge of #147784 - nxsaken:div_exact_return_option, r=dtolnay
Return `Option` from `exact_div` and inherit overflow checks

According to https://github.com/rust-lang/rust/issues/139911#issuecomment-3404056127, `exact_div` should return `Option::None` if `self % rhs != 0`, panic if `rhs == 0`, and handle overflow conditionally (panic in debug, wrap in release).

rust-lang/rust#147771 should rename `exact_div` to `div_exact`.
2025-11-02 08:05:11 +00:00
Matthias Krüger 75fbbd32f0 Rollup merge of #147622 - Kmeakin:km/unicode-data/refactors, r=joboet
`unicode_data` refactors

Minor refactors to `unicode_data` that occured to me while trying to reduce the size of the tables. Splitting into a separate PR. NFC
2025-10-31 18:41:48 +01:00
Karl Meakin 0e6131c9aa refactor: make unicode_data tests normal tests
Instead of generating a standalone executable to test `unicode_data`,
generate normal tests in `coretests`. This ensures tests are always
generated, and will be run as part of the normal testsuite.

Also change the generated tests to loop over lookup tables, rather than
generating a separate `assert_eq!()` statement for every codepoint. The
old approach produced a massive (20,000 lines plus) file which took
minutes to compile!
2025-10-31 14:12:17 +00:00
ltdk 6f649e4e1a const select_unpredictable 2025-10-26 21:33:00 -04:00
Romain Perier 70876ee42b Unify and deduplicate max recip float tests 2025-10-25 17:57:06 +02:00
Matthias Krüger 8c40b9c6d7 Rollup merge of #147788 - clarfonthey:const-cell, r=oli-obk
const Cell methods

Tracking: rust-lang/rust#147787

r? `@oli-obk`
2025-10-22 07:12:11 +02:00
ltdk 31a2c565bd Move const_drop_in_place test from ptr to manually_drop module 2025-10-19 14:43:45 -04:00
Matthias Krüger cb3c6edc9b Rollup merge of #147258 - hkBst:panic-last-repeat, r=scottmcm
iter repeat: panic on last

https://github.com/rust-lang/rust/issues/146660#issuecomment-3356842371
2025-10-18 08:08:36 +02:00
ltdk 97b7170eef const Cell methods 2025-10-16 16:09:31 -04:00
nxsaken 298d825cbb Return Option from exact_div and inherit overflow checks 2025-10-16 22:03:50 +04:00
Matthias Krüger 252974a717 Rollup merge of #146187 - clarfonthey:const-drop-in-place, r=oli-obk
Unstably constify `ptr::drop_in_place` and related methods

Tracking: rust-lang/rust#109342
Supercedes: rust-lang/rust#145725

Makes methods const:

* `core::ptr::drop_in_place`
* `core::mem::ManuallyDrop::drop`
* `core::mem::MaybeUninit::assume_init_drop`
* `<[core::mem::MaybeUninit<_>]>::assume_init_drop`
* `<*mut _>::drop_in_place`
* `core::ptr::NonNull::drop_in_place`
2025-10-14 19:47:28 +02:00
Matthias Krüger 817720c9a9 Rollup merge of #138799 - joboet:extend-tuple, r=Mark-Simulacrum
core: simplify `Extend` for tuples

This is an alternative to https://github.com/rust-lang/rust/pull/137400. The current macro is incredibly complicated and introduces subtle bugs like calling the `extend_one` of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from https://github.com/rust-lang/rust/pull/137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized `Extend` implementations of the individual collection.
2025-10-12 10:13:12 +02:00
Marijn Schouten d52744e9fc iter repeat: panic on last 2025-10-07 16:43:48 +00:00
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
Jeremy Smart 78d8ce7301 add SliceIndex wrapper types Last and Clamp<Idx> 2025-09-15 15:25:12 -04: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