Commit Graph

27685 Commits

Author SHA1 Message Date
Jonathan Brouwer c82d8db4a8 Rollup merge of #154103 - tgross35:float-test-mod, r=folkertdev
coretests: Expand ieee754 parsing and printing tests to f16

Use `float_test!` to cover all types, with a note about f128 missing the traits. Also includes some minor reorganization.
2026-03-20 13:24:21 +01:00
Stuart Cook 83d921de92 Rollup merge of #154019 - cyrgani:feature-clean, r=joboet
two smaller feature cleanups

Remove an unneeded feature gate for a private macro and sort the used features correctly by whether they are language or library features.
2026-03-20 15:33:07 +11:00
Trevor Gross 16f89853f7 coretests: Expand ieee754 parsing and printing tests to f16
Use `float_test!` to cover all types, with a note about f128 missing the
traits.
2026-03-19 17:04:17 +00:00
Trevor Gross 4211234269 coretests: Give ieee754.rs a more accurate name 2026-03-19 16:21:40 +00:00
Trevor Gross f9c0284206 coretests: Move the float module under num
This is just a single file, so move it under `num` which already has
some float-related tests. This also closer mirrors source in `core`.
2026-03-19 15:42:55 +00:00
Jonathan Brouwer 793d1c9a2e Rollup merge of #153804 - DanielEScherzer:derive-eq-docs, r=Mark-Simulacrum
Derive Macro Eq: link to more detailed documentation

Match the other derive macros in the module (Ord, PartialEq, PartialOrd) by linking to the section in the trait documentation about how the derive macro works.
2026-03-19 13:42:36 +01:00
Jonathan Brouwer 981f837e2d Rollup merge of #153170 - LevitatingBusinessMan:is_disconnected, r=Mark-Simulacrum
Add is_disconnected functions to mpsc and mpmc channels

Add `is_disconnected()` functions to the `Sender` and `Receiver` of both `mpmc` an `mpsc` channels.

```rust
std::sync::mpmc::Sender<T>::is_disconnected(&self) -> bool
std::sync::mpmc::Receiver<T>::is_disconnected(&self) -> bool

std::sync::mpsc::Sender<T>::is_disconnected(&self) -> bool
std::sync::mpsc::Receiver<T>::is_disconnected(&self) -> bool
```

The `mpsc` methods are locked behind the `mpsc_is_disconnected` feature gate, which has no tracking issue yet.

ACP: https://github.com/rust-lang/libs-team/issues/748
Tracking issue: https://github.com/rust-lang/rust/issues/153668
2026-03-19 13:42:33 +01:00
Jonathan Brouwer 7c6fc44b7c Rollup merge of #151905 - tgross35:dec2flt-traits, r=Mark-Simulacrum
Split the `dec2flt::RawFloat` trait for easier reuse

`RawFloat` is an internal trait with quite a few useful float properties. It currently resides in the `dec2flt` module but is also used in parsing, and would be nice to reuse other places. Unfortunately it cannot be implemented on `f128` because of limitations with how the parsing API is implemented (mantissa must fit into a u64).

To make the trait easier to work with, split it into the following:

* `Float`: Anything that is reasonably applicable to all floating point types.
* `FloatExt`: Items that should be part of `Float` but don't work for all float types. This will eventually be merged back into `Float` once it can be implemented on f128.
* `Lemire`: Items that are specific to the Lemire dec2flt algorithm.

These traits are then moved to places that make sense.

Builds on top of https://github.com/rust-lang/rust/pull/151900
2026-03-19 13:42:32 +01:00
Jonathan Brouwer f7ac53b661 Rollup merge of #154077 - jhpratt:optimize-128-bit-formatting, r=dtolnay
Optimize 128-bit integer formatting

The compiler is unaware of the restricted range of the input, so it is unable to optimize out the final division and modulus. By doing this manually, we get a nontrivial performance gain.

r? @dtolnay

(copied from https://github.com/dtolnay/itoa/pull/68)
2026-03-19 13:42:30 +01:00
Jonathan Brouwer ea542a0ea8 Rollup merge of #153824 - samueltardieu:wake-diagnostic-item, r=Mark-Simulacrum
Add `Wake` diagnostic item for `alloc::task::Wake`

The symbol will be defined in Clippy, as Clippy will be the sole user of the diagnostic item so far.
2026-03-19 13:42:29 +01:00
Jonathan Brouwer 2c49023125 Rollup merge of #153333 - gautam899:main, r=Mark-Simulacrum
Fix bootstrap rust build failure for vxworks

Fixes rust-lang/rust#153332

Starting with VxWorks 25.09, struct stat was updated to use struct timespec instead of time_t for timestamp fields.

The following changes were made in libc in the commit [libc](https://github.com/rust-lang/libc/pull/4781).

As a result, when performing a bootstrap build with VxWorks ≥ 25.09, libc no longer exposes the fields st_mtime, st_atime, and st_ctime, as they are conditionally compiled in src/vxworks/mod.rs here [libc](https://github.com/rust-lang/libc/blob/56caa81b6b433c49c5704bf0400a02d428cfacda/src/vxworks/mod.rs#L229). This causes the build to fail.

For VxWorks versions earlier than 25.09, the build completes successfully without errors.

This PR resolves the issue by detecting the WIND_RELEASE_ID environment variable (which is set in the VxWorks build environment) and conditionally guarding the affected functions in the two additional files where the errors originate.
2026-03-19 13:42:25 +01:00
bors 8b86f48958 Auto merge of #153480 - RaphiMuehlbacher:track-caller, r=Mark-Simulacrum
Add missing `track_caller` to overflowing trait methods

Fixes rust-lang/rust#152599 by adding `#[track_caller]` to arithmetic trait methods (`Neg`, `Shl`, `ShlAssign`, `Shr` and `ShrAssign`) so overflow panics report the correct call site instead of the trait definition.
2026-03-19 05:52:42 +00:00
Jacob Pratt ebb1f470ca Optimize 128-bit integer formatting
The compiler is unaware of the restricted range of the input, so it is
unable to optimize out the final division and modulus. By doing this
manually, we get a nontrivial performance gain.
2026-03-19 01:08:01 -04:00
Stuart Cook 43e48595e4 Rollup merge of #153985 - lms0806:issue-153542, r=scottmcm
doc: clarify allocator invariant

Added base + size <= usize::MAX to the Allocator documentation.

Please refer to issue [153542](https://github.com/rust-lang/rust/issues/153542).

Close rust-lang/rust#153542
2026-03-18 18:37:36 +11:00
Stuart Cook eeb140dafa Rollup merge of #153945 - theemathas:unwind_safe_pointee_sized, r=scottmcm
Change `?Sized` to `PointeeSized` in `UnwindSafe` impls for pointers

Tracking issue: rust-lang/rust#144404.

This PR is similar to rust-lang/rust#152646.
2026-03-18 18:37:35 +11:00
Stuart Cook 04e7f2f72e Rollup merge of #153677 - ConradIrwin:sanitary-string-panics, r=scottmcm
Remove string content from panics

String content can be useful for debugging panics, particularly when you are working on a small codebase where you can infer more about the path taken through your program based on the content of the string.

In production deployments that upload crashes for centralized debugging, string content poses a risk to user privacy. The string can accidentally contain information that the user is not expecting to share with the development team.

On balance it seems like the risks outweigh the benefits. It is easy to add a `dbg!()` statement to gather more information in development; but comparatively tricky to ensure panics are sanitized by every rust app that monitors their production deployments.

Ref https://internals.rust-lang.org/t/stop-including-string-content-in-index-panics/24067

r? @scottmcm
2026-03-18 18:37:35 +11:00
Jonathan Brouwer eb6170697d Rollup merge of #154012 - folkertdev:f128-from-instances, r=tgross35
unstable impl of `From<{i64, u64}> for f128`

r? tgross35
2026-03-17 21:20:04 +01:00
Jonathan Brouwer b1050a74cc Rollup merge of #152998 - xtqqczze:panic-truncate, r=jhpratt
std: make `OsString::truncate` a no-op when `len > current_len`

Align `OsString::truncate` (and the underlying WTF-8 implementation) with `String::truncate` by making it a no-op when `len > self.len()`.

Previously, `OsString::truncate` would panic if `len > self.len()`, while `String::truncate` treats such cases as a no-op.

Tracking (`os_string_truncate`): https://github.com/rust-lang/rust/issues/133262
See also: https://github.com/rust-lang/rust/pull/32977

cc: @alexcrichton, @lolbinarycat
2026-03-17 21:20:01 +01:00
Folkert de Vries 681b48e228 unstable impl of From<{i64, u64}> for f128 2026-03-17 18:50:39 +01:00
Jonathan Brouwer 19f292aabe Rollup merge of #153972 - folkertdev:stdarch-sync-2026-03-16, r=folkertdev,RalfJung
stdarch subtree update

Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/aa3fc334dcb21b2bf5b5b31a52c19435072d7ced.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-03-17 17:51:28 +01:00
cyrgani e350a56cf9 move features into the correct section 2026-03-17 09:31:03 +00:00
cyrgani aa7d812f34 remove internal_impls_macro feature 2026-03-17 09:27:25 +00:00
lms0806 57fe818124 doc: clarify allocator invariant 2026-03-17 14:54:10 +09:00
bors 6bdc342ddb Auto merge of #146013 - Jules-Bertholet:from-wrapper, r=Mark-Simulacrum
Add `From` impls for wrapper types





- ~`From<T: Copy> for ManuallyDrop<T>`~
- `From<T: UnwindSafe> for AssertUnwindSafe<T>`
- `From<T> for LazyCell<T, F>`
- `From<T> for LazyLock<T, F>`
- `From<T> for ThinBox<T>` (unstable)
- `From<T> for UniqueRc<T>` (unstable)
- `From<T> for UniqueArc<T>` (unstable)

@rustbot label T-libs-api needs-fcp

Also needs a crater run, as the insta-stable impls are technically breaking changes.
2026-03-17 04:14:51 +00:00
Folkert de Vries 8155209828 enable the movrs target feature in core and std 2026-03-16 23:30:37 +01:00
Sayantan Chakraborty 3776c07842 Merge pull request #2050 from folkertdev/aarch64-rand
add ACLE random number generation intrinsics
2026-03-16 21:03:10 +00:00
Jonathan Brouwer 42c5d9a455 Rollup merge of #153359 - zedddie:const-param-ty-trait-gating, r=BoxyUwU
Gate `ConstParamTy_` trait behind `const_param_ty_trait` feature

Initially even when user wasn't using unsized const params, the only way to implement/name `ConstParamTy_` was to use `#![feature(unsized_const_params]`, now its gated under `const_param_ty_trait` feature, implied by `unsized_const_params`.

I've also changed use of `unsized_const_params` in tests which were using it only to implement `ConstParamTy_` without using unsized

r? BoxyUwU
2026-03-16 13:11:00 +01:00
Tim (Theemathas) Chirananthavat a89211e552 Change ?Sized to PointeeSized in UnwindSafe impls for pointers 2026-03-16 15:15:55 +07:00
Stuart Cook eb101bb2f1 Rollup merge of #153793 - kpreid:std-mem-doc, r=scottmcm
Add overview documentation for `std::mem`.

I heard that `std::mem` sounds scary to some people, and how it’s described — “Basic functions for dealing with memory” — sounds even to me like something that should be avoided, not even because it would be unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in the module, without having to read all the individual item descriptions.

The exact contents of the list are, of course, highly debatable, and I chose not to include any of the unstable or deprecated items, nor to include `Discriminant` as well as `discriminant`. I’m also not particularly happy with the wording of the introductory paragraph.
2026-03-16 15:01:34 +11:00
Stuart Cook bd671824d5 Rollup merge of #153570 - RalfJung:assume-init-docs, r=tgross35
MaybeUninit: mention common mistakes in assume_init docs; link to validity invariant docs

Fixes https://github.com/rust-lang/rust/issues/150689
r? @tgross35
2026-03-16 15:01:33 +11:00
Ralf Jung c7220f423b rename min/maxnum intrinsics to min/maximum_number and fix their LLVM lowering 2026-03-15 14:53:00 +01:00
Jules Bertholet c5c1d94e6c Add From impls for wrapper types
- `From<T> for ThinBox<T>`
- `From<T> for UniqueRc<T>`
- `From<T> for UniqueArc<T>`
- `From<T: UnwindSafe> for AssertUnwindSafe<T>`
- `From<T> for LazyCell<T, F>`
- `From<T> for LazyLock<T, F>`
2026-03-14 22:09:35 -04:00
bors 35f1109ece Auto merge of #153866 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to https://github.com/rust-lang/compiler-builtins/commit/8173070e590c04a0d36ee9f3e0397c6006596976.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-03-14 16:56:25 +00:00
Trevor Gross 7a698be605 min,max: Add tests for signaling NaNs and update documentation
We do handle signaling NaNs properly, with the exception of raising
exceptions as IEEE 754 requires. Add tests to this effect for
`fmin`, `fminimum`, `fminimum_num`, and the max variants.
2026-03-14 07:26:20 -05:00
Trevor Gross 3a352497c3 support: Print sNaN or qNaN for hex floats
Give more descriptive output in tests since we sometimes need to treat
these differently. We still don't parse `sNaN`/`qNaN` for now, though we
could in the future.
2026-03-14 07:26:20 -05:00
Trevor Gross ccd1042884 support: Add different NaN types to the Float trait
Make `Float::NAN` a qNaN, add sNaNs, and add operations to check whether
a NaN is quiet or signaling.

The MIPS values are checked against https://gcc.godbolt.org/z/1bhsd5ana.
2026-03-14 07:26:20 -05:00
Trevor Gross 67633abc17 support: Add Hexi for printing integers in hex
Add a wrapper similar to `Hexf` to print integers with proper padding.
2026-03-14 07:26:20 -05:00
Bhavya Gautam 24d86b5f2b Fix rust build failure for vxworks 2026-03-14 17:54:19 +05:30
Trevor Gross bec94a33d5 dec2flt: Move internal traits to better locations
`Float` and `FloatExt` are already used by both parsing and printing, so
move them out of `dec2flt` to a new module in `num::imp`. `Int` `Cast`
have the potential to be used more places in the future, so move them
there as well. `Lemire` is the only remaining trait; since it is small,
move it into the `dec2flt` root.

The `fmt::LowerExp` bound is removed from `Float` here since the trait
is moving into a module without `#[cfg(not(no_fp_fmt_parse))]` and it
isn't implemented with that config (it's not easily possible to add
`cfg` attributes to a single supertrait, unfortunately). This isn't a
problem since it isn't actually being used.
2026-03-14 04:34:52 -05:00
Trevor Gross b07c0439a4 dec2flt: Split up the RawFloat trait
`RawFloat` is currently used specifically for the implementation of the
lemire algorithm, but it is useful for more than that. Split it into
three different traits:

* `Float`: Anything that is reasonably applicable to all floating point
  types.
* `FloatExt`: Items that should be part of `Float` but don't work for
  all float types. This will eventually be merged back into `Float`.
* `Lemire`: Items that are specific to the Lemire algorithm.
2026-03-14 04:34:52 -05:00
Trevor Gross 02ac190909 dec2flt: Rename Integer to Int
This is more consistent with what the trait is called elsewhere in tree
(specifically compiler-builtins and test-float-parse).
2026-03-14 04:34:52 -05:00
Stuart Cook 4b35702611 Rollup merge of #153774 - sardok:fix_sgx_std_doctest_build, r=WaffleLapkin
Fix std doctest build for SGX target.

This PR fixes standard library doctest build for `x86_64-fortanix-unknown-sgx` target.
2026-03-14 17:30:24 +11:00
Kevin Reid b1b87ffdbc Add overview documentation for std::mem.
I heard that `std::mem` sounds scary to some people, and how it’s
described — “Basic functions for dealing with memory” — sounds even to
me like something that should be avoided, not even because it would be
unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in
the module, without having to read all the individual item descriptions.
2026-03-13 17:38:38 -07:00
Matthias Krüger 42c7f52939 Rollup merge of #153569 - abh1nav10:fix-pin-docs, r=joboet
Fix grammar in Pin documentation

Changed "has an address-sensitive" to "has address-sensitive states" in the `Drop` implementation section of the documentation of `Pin` thereby making it grammatically complete.
2026-03-13 19:50:13 +01:00
Matthias Krüger 12d320f884 Rollup merge of #153418 - softmoth:patch-1, r=joboet
core: remove FIXME comment in option.rs FromIterator

The referenced issue rust-lang/rust#11084 was closed in 2021, and the related PR rust-lang/rust#59605 was not merged due to inconclusive results. Similar code (in result.rs, for example) doesn't have this FIXME comment; this is the only reference to issue 11084 (or pull request 59605).

This FIXME was not mentioned in issue rust-lang/rust#44366.
2026-03-13 19:50:13 +01:00
Samuel Tardieu 6e7d6d7821 Add Wake diagnostic item for alloc::task::Wake 2026-03-13 14:57:07 +01:00
Jonathan Brouwer 935805e80a Rollup merge of #153384 - safer-rust:main, r=oli-obk
Add missing safety doc for CString::from_vec_unchecked and async_drop_in_place

Add missing safety documentation for two unsafe APIs:

* `CString::from_vec_unchecked` – # Safety: the caller must ensure `v` contains no NUL bytes in its contents.
* `async_drop_in_place` – # Safety: see [`ptr::drop_in_place`] for safety requirements.
2026-03-13 13:27:49 +01:00
aisr 3771c65b53 add safety doc for CString::from_vec_unchecked and async_drop_in_place 2026-03-13 20:08:37 +08:00
Folkert de Vries ccf7d4e978 inline assert_instr tests 2026-03-13 11:09:47 +01:00
Abhinav 49163144b1 Fix grammar in Pin documentation 2026-03-13 10:40:59 +05:30