Commit Graph

423 Commits

Author SHA1 Message Date
Ralf Jung 0fd3ac4c97 libcore float tests: replace macro shadowing by const-compatible macro 2026-03-06 12:07:25 +01:00
Jonathan Brouwer 1c44dbd580 Rollup merge of #152164 - mu001999-contrib:lint/unused_features, r=JonathanBrouwer
Lint unused features

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152164)*

Fixes rust-lang/rust#44232
Fixes rust-lang/rust#151752

---

This PR records used features through query side effect, then reports unsued features finally.
2026-03-04 19:30:36 +01:00
Stuart Cook 54bb7b8212 Rollup merge of #153358 - eggyal:duration-flop-boundary-tests, r=tgross35
Boundary tests for various Duration-float operations

As requested in https://github.com/rust-lang/rust/pull/150933#discussion_r2875490030

r? tgross35
2026-03-04 11:54:09 +11:00
mu001999 7ffaa41662 Remove unused features in library tests 2026-03-04 08:06:44 +08:00
Alan Egerton d96ec37d7e Boundary tests for various Duration-float operations 2026-03-03 19:01:53 +00:00
Jonathan Brouwer f4810cb4a3 Rollup merge of #152911 - nxsaken:stable_control_flow_ok, r=dtolnay
Stabilize `control_flow_ok`

Feature: `control_flow_ok`
Tracking issue: rust-lang/rust#140266

r? @dtolnay
2026-03-03 19:11:49 +01:00
Jonathan Brouwer c4384629c0 Rollup merge of #153265 - asder8215:intersperse_changes, r=jhpratt
Clarified doc comments + added tests confirming current behavior for intersperse/intersperse_with

This PR builds on top of rust-lang/rust#152855. I just added clarifying comments to `intersperse`/`intersperse_with` about its guarantees for fused iterators (and how behavior for non-fused iterators are subject to change). I also added in tests for non-fused iterators demonstrating its current behavior; fused iterators are already tested for in existing tests for `intersperse`/`intersperse_with`.
2026-03-03 07:14:12 +01:00
Mahdi Ali-Raihan c8d343e5c8 Added guarantee and non-guarantee comments + tests for intersperse/intersperse_with regarding fused/non-fused iterators 2026-03-02 19:44:15 -05:00
mu001999 ff0f239bb1 Remove redundant self usages 2026-02-25 22:51:53 +08:00
Jonathan Brouwer 1d6e7ec8d4 Rollup merge of #152003 - 9SonSteroids:trait_info_of, r=oli-obk
Reflection TypeId::trait_info_of

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152003)*

This is for https://github.com/rust-lang/rust/issues/146922.

As https://github.com/rust-lang/rust/pull/151236 was requested to be remade by someone I implemented the functionality as `TypeId::trait_info_of` which additionally allows getting the vtable pointer to build `dyn` Objects in recursive reflection.

It allows checking if a TypeId implements a trait. Since this is my first PR feel free to tell me if there are any formal issues.
2026-02-23 20:46:11 +01:00
Folkert de Vries 14d29f9ae2 Stabilize cfg_select 2026-02-22 19:59:25 +01:00
nxsaken e9bf9291a7 Stabilize control_flow_ok 2026-02-20 18:18:34 +04:00
jasper3108 7857058a6b nix vtable_for intrinsic 2026-02-20 10:16:36 +01:00
jasper3108 01627b7441 Support getting TypeId's Trait and vtable 2026-02-20 10:16:36 +01:00
Jonathan Brouwer 5d6c830832 Rollup merge of #152173 - 9SonSteroids:fn_ptr_type_info, r=oli-obk
Reflection TypeKind::FnPtr

This is for https://github.com/rust-lang/rust/issues/146922.

Const-eval currently lacks full support for function pointer (fn) types. We should implement handling of FnPtr TypeKind, covering safe and unsafe functions, Rust and custom ABIs, input and output types, higher-ranked lifetimes, and variadic functions.
2026-02-18 22:19:49 +01:00
jasper3108 7287be9006 Implement reflection support for function pointer types and add tests
- Implement handling of FnPtr TypeKind in const-eval, including:
  - Unsafety flag (safe vs unsafe fn)
  - ABI variants (Rust, Named(C), Named(custom))
  - Input and output types
  - Variadic function pointers
- Add const-eval tests covering:
  - Basic Rust fn() pointers
  - Unsafe fn() pointers
  - Extern C and custom ABI pointers
  - Functions with multiple inputs and output types
  - Variadic functions
- Use const TypeId checks to verify correctness of inputs, outputs, and payloads
2026-02-18 17:18:16 +01:00
okaneco 67799c9739 core: Implement feature float_exact_integer_constants
Implement accepted ACP for `MAX_EXACT_INTEGER` and `MIN_EXACT_INTEGER`
on `f16`, `f32`, `f64`, and `f128`
Add tests to `coretests/tests/floats/mod.rs`
Disable doc tests for i586 since float<->int casts return incorrect
results
2026-02-16 16:29:31 -05:00
xonx 2c1d605f21 unify and deduplicate floats 2026-02-15 18:00:41 +00:00
Folkert de Vries b935f379b4 implement carryless_mul 2026-02-14 21:23:30 +01:00
mu001999 73c42c1800 Remove or allow unused features in library doc and tests 2026-02-13 09:27:16 +08:00
Asuna a575fe168f Erase type lifetime before writing type ID 2026-02-10 14:08:11 +01:00
Asuna 98e0c34f7f Support unions in type info reflection 2026-02-10 13:53:27 +01:00
Asuna e9037882c1 Support enums in type info reflection 2026-02-10 13:53:26 +01:00
Asuna 870fd9070b Add generics info for structs in type info 2026-02-10 13:45:09 +01:00
Asuna b23d308853 Support structs in type info reflection 2026-02-10 13:45:07 +01:00
Shun Sakai d837cf6700 feat: Implement int_from_ascii for NonZero<T> 2026-02-07 13:48:52 +09:00
Shun Sakai d0aa337146 feat: Add NonZero::<T>::from_str_radix 2026-02-06 16:15:00 +09:00
ltdk 28feae0c87 Move bigint helper tracking issues 2026-02-02 18:45:26 -05:00
Jacob Pratt 4e21b69e5a Rollup merge of #151812 - scottmcm:slice-shift, r=jhpratt
Add `shift_{left,right}` on slices

ACP approval: https://github.com/rust-lang/libs-team/issues/717#issuecomment-3807205664
cc tracking issue rust-lang/rust#151772
2026-01-30 22:52:21 -05:00
Deadbeef 6147a3fc88 constify Iterator 2026-01-30 15:52:40 +00:00
Scott McMurray 4264da6869 Add shift_{left,right} on slices
cc tracking issue 151772
2026-01-29 11:12:54 -08:00
theiz a1893d3187 Add support for trait object types in type_info reflection 2026-01-27 19:49:09 -04:00
Stuart Cook 1c892e829c Rollup merge of #147436 - okaneco:eq_ignore_ascii_autovec, r=scottmcm
slice/ascii: Optimize `eq_ignore_ascii_case` with auto-vectorization

- Refactor the current functionality into a helper function
- Use `as_chunks` to encourage auto-vectorization in the optimized chunk processing function
- Add a codegen test checking for vectorization and no panicking
- Add benches for `eq_ignore_ascii_case`

---

The optimized function is initially only enabled for x86_64 which has `sse2` as part of its baseline, but none of the code is platform specific. Other platforms with SIMD instructions may also benefit from this implementation.

Performance improvements only manifest for slices of 16 bytes or longer, so the optimized path is gated behind a length check for greater than or equal to 16.

Benchmarks - Cases below 16 bytes are unaffected, cases above all show sizeable improvements.
```
before:
    str::eq_ignore_ascii_case::bench_large_str_eq         4942.30ns/iter +/- 48.20
    str::eq_ignore_ascii_case::bench_medium_str_eq         632.01ns/iter +/- 16.87
    str::eq_ignore_ascii_case::bench_str_17_bytes_eq        16.28ns/iter  +/- 0.45
    str::eq_ignore_ascii_case::bench_str_31_bytes_eq        35.23ns/iter  +/- 2.28
    str::eq_ignore_ascii_case::bench_str_of_8_bytes_eq       7.56ns/iter  +/- 0.22
    str::eq_ignore_ascii_case::bench_str_under_8_bytes_eq    2.64ns/iter  +/- 0.06
after:
    str::eq_ignore_ascii_case::bench_large_str_eq         611.63ns/iter +/- 28.29
    str::eq_ignore_ascii_case::bench_medium_str_eq         77.10ns/iter +/- 19.76
    str::eq_ignore_ascii_case::bench_str_17_bytes_eq        3.49ns/iter  +/- 0.39
    str::eq_ignore_ascii_case::bench_str_31_bytes_eq        3.50ns/iter  +/- 0.27
    str::eq_ignore_ascii_case::bench_str_of_8_bytes_eq      7.27ns/iter  +/- 0.09
    str::eq_ignore_ascii_case::bench_str_under_8_bytes_eq   2.60ns/iter  +/- 0.05
```
2026-01-27 17:36:35 +11:00
Juho Kahala 29596f87be rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits 2026-01-26 06:28:42 +02:00
Jonathan Brouwer 474c9fe9a4 Rollup merge of #151489 - bend-n:constify-all-boolean-methods-under-feature-gate-const-bool, r=jhpratt
constify boolean methods

```rs
// core::bool

impl bool {
    pub const fn then_some<T: [const] Destruct>(self, t: T) -> Option<T>;
    pub const fn then<T, F: [const] FnOnce() -> T + [const] Destruct>(self, f: F) -> Option<T>;
    pub const fn ok_or<E: [const] Destruct>(self, err: E) -> Result<(), E>;
    pub const fn ok_or_else<E, F: [const] FnOnce() -> E + [const] Destruct>;
}
```

will make tracking issue if pr liked
2026-01-24 08:18:07 +01:00
bendn 207dcbbe7c constify boolean methods 2026-01-23 15:12:47 +07:00
bendn 081c4c6abb reenable tests 2026-01-23 14:26:26 +07:00
Trevor Gross 490b307740 cleanup: Start splitting FIXME(f16_f128) into f16, f128, or f16,f128
Make it easier to identify which FIXMEs are blocking stabilization of
which type.
2026-01-22 23:41:57 -06:00
Trevor Gross 8840409f7a f16,f128: Resolve cfg-releated instances of FIXME(f16_f128)
There are a number of instances of `FIXME(f16_f128)` related to target
configuration; either these could use `target_has_reliable_f128`, or the
FIXME is describing such a cfg and is thus redundant (since any
`cfg(target_has_reliable_f*)` needs to be removed before stabilization
anyway).

Switch to using `target_has_reliable_*` where applicable and remove the
redundant FIXMEs.
2026-01-22 23:41:57 -06:00
BD103 a509588fa9 feat: support slices in reflection type info 2026-01-21 16:03:00 -06:00
BD103 976cea3a18 feat: support pointers in type info 2026-01-19 09:42:55 -06:00
Jacob Pratt 80db7158af Rollup merge of #151235 - type-info-rename-bits, r=oli-obk
Change field `bit_width: usize` to `bits: u32` in type info

Follow-up https://github.com/rust-lang/rust/pull/151123#discussion_r2698418929. Quotes:

@Skgland:
> > I'm not sure whether we should use `usize` or `u64` here to represent the bit width.
>
> My expectation would be `u32` matching the associated `{u,i}N::BITS`[^1][^2][^3] constant that already exists on the integer types.
>
> [^1]: https://doc.rust-lang.org/std/primitive.i8.html#associatedconstant.BITS
> [^2]: https://doc.rust-lang.org/std/primitive.i128.html#associatedconstant.BITS
> [^3]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.BITS

@SpriteOvO:
> I found some [previous discussions](https://github.com/rust-lang/rust/pull/76492#issuecomment-700516940) regarding the type of `::BITS` constant. And during the stabilization of `::BITS`, the choice of `u32` affected some ecosystem crates (#81654), but soon after, these crates all accepted the `u32` type.
>
> So I think it makes sense to keep the type consistent with `::BITS` here. Then I'd also like to change the name from `bit_width` to `bits`, also for consistency.

r? @oli-obk
2026-01-18 03:16:46 -05:00
Jacob Pratt 99b29620ca Rollup merge of #148769 - stabilize/alloc_layout_extra, r=scottmcm
Stabilize `alloc_layout_extra`

Tracking issue: rust-lang/rust#55724
FCP completed in https://github.com/rust-lang/rust/issues/55724#issuecomment-3447699364
Closes rust-lang/rust#55724

----

As per https://github.com/rust-lang/rust/issues/55724#issuecomment-3403555985,
- `repeat_packed` and `extend_packed` are unchanged
- `repeat` now excludes trailing padding on the last element from the total array size
- `dangling` renamed to `dangling_ptr`
- `padding_needed_for` not stabilized, changed to accept `Alignment` instead of `usize` and moved to the `ptr_aligment_type` feature flag (tracking issue: rust-lang/rust#102070)
2026-01-18 03:16:44 -05:00
Asuna 27b0279660 Change field bit_width: usize to bits: u32 in type info 2026-01-17 01:53:08 +01:00
Jamie Hill-Daniel c7031e93c5 feat: Support references in reflection type info 2026-01-17 00:25:29 +00:00
Matthias Krüger 225ba69ee2 Rollup merge of #151123 - type-info-primitives, r=oli-obk
Support primitives in type info reflection

Tracking issue: rust-lang/rust#146922 `#![feature(type_info)]`

This PR supports {`bool`,`char`,`int`,`uint`,`float`,`str`} primitive types for feature `type_info` reflection.

r? @oli-obk
2026-01-16 13:57:46 +01:00
Jacob Pratt 0cef925c52 Rollup merge of #150611 - from-bool-float-test, r=tgross35
Unify and deduplicate From<T> float tests

cc rust-lang/rust#141726

Unify the From<bool> tests from f16.rs and f128.rs into a single float_test! in mod.rs.
2026-01-15 19:35:46 -05:00
Asuna b2a7b18ec4 Merge type info variant Uint into Int 2026-01-15 23:04:40 +01:00
Asuna 79ec275e2d Support primitives in type info reflection
Support {bool,char,int,uint,float,str} primitive types for feature
`type_info` reflection.
2026-01-14 19:15:39 +01:00
BD103 71f8ea99fe refactor: move tuples type info ui test to coretest 2026-01-13 12:19:37 -05:00