Commit Graph

9393 Commits

Author SHA1 Message Date
bors
b53c72ffaa Auto merge of #144494 - scottmcm:min_bigint_helpers, r=Mark-Simulacrum
Partial-stabilize the basics from `bigint_helper_methods`

Direct link to p-FCP comment: https://github.com/rust-lang/rust/pull/144494#issuecomment-3133172161

After libs-api discussion, this is now the following methods:

- [`uN::carrying_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_add): uN + uN + bool -> (uN, bool)
- [`uN::borrowing_sub`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.borrowing_sub): uN + uN + bool -> (uN, bool)
- [`uN::carrying_mul`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_mul): uN * uN + uN -> (uN, uN)
- [`uN::carrying_mul_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_mul_add): uN * uN + uN + uN -> (uN, uN)

Specifically, these are the ones that are specifically about working with `uN` as a "digit" (or "limb") where the output, despite being larger than can fit in a single digit, wants to be phrased in terms of those *digits*, not in terms of a wider type.

(This leaves open the possibility of things like `widening_mul: u32 * u32 -> u64` for places where one wants to only think in terms of the *number*s, rather than as carries between multiple digits.  Though of course discussions about how best to phrase such a thing are best for the tracking issue, not for this PR.)

---

**Original PR description**:

A [conversation on IRLO](https://internals.rust-lang.org/t/methods-for-splitting-integers-into-their-halves/23210/7?u=scottmcm) the other day pushed me to write this up 🙂

This PR proposes a partial stabilization of `bigint_helper_methods` (rust-lang/rust#85532), focusing on a basic set that hopefully can be non-controversial.  Specifically:

- [`uN::carrying_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_add): uN + uN + bool -> (uN, bool)
- [`uN::widening_mul`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.widening_mul): uN * uN -> (uN, uN)
- [`uN::carrying_mul_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_mul_add): uN * uN + uN + uN -> (uN, uN)

Why these?

- We should let people write Rust without needing to be backend experts to know what the magic incantation is to do this.  Even `carrying_add`, which doesn't seem that complicated, actually broke in 1.82 (see rust-lang/rust#133674) so we should just offer something fit-for-purpose rather than making people keep up with whatever the secret sauce is today.  We also get to do things that users cannot, like have the LLVM version emit operations on `i256` in the implementation of `u128::carrying_mul_add` (https://rust.godbolt.org/z/cjG7eKcxd).
- Unsigned only because the behaviour is much clearer than when signed is involved, as everything is just unsigned (vs questions like whether `iN * iN` should give `(uN, iN)`) and carries can only happen in one direction (vs questions about whether the carry from `-128_u8 + -128_u8` should be considered `-1`).
- `carrying_add` is the core [full adder](https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder) primitive for implementing addition.
- `carrying_mul_add` is the core primitive for [grade school](https://en.wikipedia.org/wiki/Multiplication_algorithm#Long_multiplication) multiplication (see the example in its docs for why both carries are needed).
- `widening_mul` even though it's not strictly needed (its implementation is just `carrying_mul_add(a, b, 0, 0)` right now) as the simplest way for users to get to [cranelift's `umulhi`](https://docs.rs/cranelift/latest/cranelift/prelude/trait.InstBuilder.html#method.umulhi), RISC-V's `MULHU`, Arm's `UMULL`, etc.  (For example, I added an ISLE pattern d12e4237de (diff-2041f67049d5ac3d8f62ea91d3cb45cdb8608d5f5cdab988731ae2addf90ef01) so Cranelift can notice what's happening from the fallback, even if the intrinsics aren't overridden specifically.  And on x86 this is one of the simplest possible non-trivial functions <https://rust.godbolt.org/z/4oadWKTc1> because `MUL` puts the results in exactly the registers that the scalar pair result happens to want.)

(I did not const-stabilize them in this PR because [the fallbacks](https://github.com/rust-lang/rust/blob/master/library/core/src/intrinsics/fallback.rs) are using `#[const_trait]` plus there's two [new intrinsic](https://doc.rust-lang.org/nightly/std/intrinsics/fn.disjoint_bitor.html)s involved, so I didn't want to *also* open those cans of worms here.  Given that both intrinsics *have* fallbacks, and thus don't do anything that can't already be expressed in existing Rust, const-stabilizing these should be straight-forward once the underlying machinery is allowed on stable.  But that doesn't need to keep these from being usable at runtime in the mean time.)
2025-08-30 04:14:07 +00:00
Trevor Gross
751a9ad2e2 Rollup merge of #145756 - okaneco:stabilize_char_boundary, r=scottmcm
str: Stabilize `round_char_boundary` feature

Closes https://github.com/rust-lang/rust/issues/93743
FCP completed https://github.com/rust-lang/rust/issues/93743#issuecomment-3168382171
2025-08-29 19:33:03 -05:00
Trevor Gross
ed9e767c01 Rollup merge of #145467 - Kivooeo:stabilize-strict_provenance_atomic_ptr, r=scottmcm
Stabilize `strict_provenance_atomic_ptr` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/99108) and stabilises `AtomicPtr::{fetch_ptr_add, fetch_ptr_sub, fetch_byte_add, fetch_byte_sub, fetch_or, fetch_and, fetch_xor}`

---

EDIT: FCP completed at https://github.com/rust-lang/rust/issues/99108#issuecomment-3168260347
2025-08-29 19:33:02 -05:00
Stuart Cook
5c0cd83301 Rollup merge of #145972 - neeko-cat:patch-2, r=ibraheemdev
fix `core::marker::Destruct` doc

`~const` bounds are now `[const]` I think...

Related:   rust-lang/rust#143874, rust-lang/rust#133214
2025-08-29 12:54:13 +10:00
Stuart Cook
ef50370ec1 Rollup merge of #144275 - Qelxiros:saturating-arithmetic, r=tgross35
implement Sum and Product for Saturating(u*)

ACP: rust-lang/libs-team#604

`@rustbot` label +needs-fcp
2025-08-29 12:54:09 +10:00
Jeremy Smart
1a33d628df implement Sum and Product for Saturating(u*) 2025-08-28 18:38:53 -04:00
neeko-cat
df802ccd2f fix core::marker::Destruct doc 2025-08-28 22:19:37 +02:00
Stuart Cook
f6c56bcd66 Rollup merge of #145930 - GrigorenkoPV:const_str_as_str, r=joshtriplett
`const`ify (the unstable) `str::as_str`

Tracking issue: rust-lang/rust#130366

The method was not initially marked `const` presumably because it is only useful with `Deref`. But now that const traits seem to be a thing that can actually become real, why not make it `const`?

PR `const`ifying `Deref`: rust-lang/rust#145279
2025-08-28 23:10:36 +10:00
Stuart Cook
c838117620 Rollup merge of #145928 - Darksonn:file_as_c_str, r=joshtriplett
Rename `Location::file_with_nul` to `file_as_c_str`

This renames the method to be consistent with the ongoing T-libs-api FCP found at https://github.com/rust-lang/rust/issues/141727#issuecomment-3228016708.

I did not rename the unstable feature as we are going to be stabilizing it soon anyway. This will probably break RfL, so it will require an updated commit hash for the Linux Kernel that I will add here soon.

r? `@Amanieu`
2025-08-28 23:10:35 +10:00
Stuart Cook
3f89664f64 Rollup merge of #145913 - heiher:loong-hint, r=joshtriplett
Add spin_loop hint for LoongArch
2025-08-28 23:10:34 +10:00
Pavel Grigorenko
e06cd9f2c8 constify (the unstable) str::as_str 2025-08-27 16:26:24 +03:00
Alice Ryhl
dacae07b6d Rename Location::file_with_nul to file_as_c_str 2025-08-27 12:42:49 +00:00
Matthias Krüger
c0cd29ed66 Rollup merge of #145625 - karolzwolak:f16-use-expr-instead-literal, r=beetrees,tgross35
improve float to_degrees/to_radians rounding comments and impl

This PR makes `to_degrees()` and `to_radians()` float functions more consistent between each other and improves comments around their precision and rounding.

* revise comments explaining why we are using literal or expression
* add unspecified precision comments as we don't guarantee precision
* use expression in `f128::to_degrees()`
* make `f64::to_degrees()` impl consistent with other functions

r? `@tgross35`
2025-08-27 11:26:50 +02:00
Matthias Krüger
1e90922864 Rollup merge of #144274 - Qelxiros:option-reduce, r=tgross35
add Option::reduce

Tracking issue: rust-lang/rust#144273
2025-08-27 11:26:48 +02:00
WANG Rui
0da328b2c6 Add spin_loop hint for LoongArch 2025-08-27 16:40:54 +08:00
Matthias Krüger
62e5341661 Rollup merge of #145335 - clarfonthey:wtf8-core-alloc, r=Mark-Simulacrum
Move WTF-8 code from std into core and alloc

This is basically a small portion of rust-lang/rust#129411 with a smaller scope. It *does not*\* affect any public APIs; this code is still internal to the standard library. It just moves the WTF-8 code into `core` and `alloc` so it can be accessed by `no_std` crates like `backtrace`.

> \* The only public API this affects is by adding a `Debug` implementation to `std::os::windows::ffi::EncodeWide`, which was not present before. This is due to the fact that `core` requires `Debug` implementations for all types, but `std` does not (yet) require this. Even though this was ultimately changed to be a wrapper over the original type, not a re-export, I decided to keep the `Debug` implementation so it remains useful.

Like we do with ordinary strings, the tests are still located entirely in `alloc`, rather than splitting them into `core` and `alloc`.

----

Reviewer note: for ease of review, this is split into three commits:

1. Moving the original files into their new "locations"
2. Actually modifying the code to compile.
3. Removing aesthetic changes that were made so that the diff for commit 2 was readable.

You can review commits 1 and 3 to verify these claims, but commit 2 contains the majority of the changes you should care about.

----

API changes: `impl Debug for std::os::windows::ffi::EncodeWide`
2025-08-27 07:45:56 +02:00
Matthias Krüger
0c02bdc901 Rollup merge of #143341 - Manishearth:from-raw-parts-ptr-cast, r=samueltardieu
Mention that casting to *const () is a way to roundtrip with from_raw_parts

See discussion on rust-lang/rust#81513
2025-08-27 07:45:54 +02:00
Guillaume Gomez
5d95ec05f6 Rollup merge of #145863 - EliasHolzmann:formatting_options_20250825, r=m-ou-se
formatting_options: Make all methods `const`

Related to rust-lang/rust#118117.

Having `const fn`s that take a `mut &` was unstable until Rust 1.83 (see rust-lang/rust#129195). Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`.

Thanks to `@Ternvein` for bringing this to my attention (see [1]).

r? `@m-ou-se` (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested)

[1]: https://github.com/rust-lang/rust/issues/118117#issuecomment-2687470635
2025-08-26 16:34:16 +02:00
Guillaume Gomez
9bb7d17d9a Rollup merge of #144373 - hkBst:remove-deprecated-1, r=jhpratt
remove deprecated Error::description in impls

[libs-api permission](https://github.com/rust-lang/libs-team/issues/615#issuecomment-3074045829)

r? `@cuviper`
or `@jhpratt`
2025-08-26 16:34:09 +02:00
Marijn Schouten
845311a065 remove deprecated Error::description in impls 2025-08-26 06:36:53 +00:00
Elias Holzmann
575a90eb87 formatting_options: Make all methods const
Having `const fn`s that take a `mut &` was unstable until Rust 1.83. Because of
this, not all methods on `FormattingOptions` were implemented as `const`. As
this has been stabilized now, there is no reason not to have all methods
`const`.

Thanks to Ternvein for bringing this to my attention (see [1]).

[1]: https://github.com/rust-lang/rust/issues/118117#issuecomment-2687470635
2025-08-26 03:42:52 +02:00
Jacob Pratt
265503668d Rollup merge of #144531 - Urgau:int_to_ptr_transmutes, r=jackh726
Add lint against integer to pointer transmutes

# `integer_to_ptr_transmutes`

*warn-by-default*

The `integer_to_ptr_transmutes` lint detects integer to pointer transmutes where the resulting pointers are undefined behavior to dereference.

### Example

```rust
fn foo(a: usize) -> *const u8 {
    unsafe {
        std::mem::transmute::<usize, *const u8>(a)
    }
}
```

```
warning: transmuting an integer to a pointer creates a pointer without provenance
   --> a.rs:1:9
    |
158 |         std::mem::transmute::<usize, *const u8>(a)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
    = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
    = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
    = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
    = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
    = note: `#[warn(integer_to_ptr_transmutes)]` on by default
help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
    |
158 -     std::mem::transmute::<usize, *const u8>(a)
158 +     std::ptr::with_exposed_provenance::<u8>(a)
    |
```

### Explanation

Any attempt to use the resulting pointers are undefined behavior as the resulting pointers won't have any provenance.

Alternatively, `std::ptr::with_exposed_provenance` should be used, as they do not carry the provenance requirement or if the wanting to create pointers without provenance `std::ptr::without_provenance_mut` should be used.

See [std::mem::transmute] in the reference for more details.

[std::mem::transmute]: https://doc.rust-lang.org/std/mem/fn.transmute.html

--------

People are getting tripped up on this, see https://github.com/rust-lang/rust/issues/128409 and https://github.com/rust-lang/rust/issues/141220. There are >90 cases like these on [GitHub search](https://github.com/search?q=lang%3Arust+%2Ftransmute%3A%3A%3Cu%5B0-9%5D*.*%2C+%5C*const%2F&type=code).

Fixes https://github.com/rust-lang/rust-clippy/issues/13140
Fixes https://github.com/rust-lang/rust/issues/141220
Fixes https://github.com/rust-lang/rust/issues/145523

`@rustbot` labels +I-lang-nominated +T-lang
cc `@traviscross`
r? compiler
2025-08-23 23:58:35 -04:00
Urgau
f25bf37f1f Allow integer_to_ptr_transmutes in core 2025-08-24 00:03:54 +02:00
Samuel Tardieu
1b9ae8f408 Rollup merge of #145515 - Kmeakin:km/optimize-char-encode-utf8, r=Mark-Simulacrum
Optimize `char::encode_utf8`

Save a few instructions in `encode_utf8_raw_unchecked` by performing manual CSE.
2025-08-23 22:22:16 +02:00
Jacob Pratt
566c13c88e Rollup merge of #145726 - aapoalas:reborrow-lang-experiment, r=petrochenkov
Experiment: Reborrow trait

Tracking issue: rust-lang/rust#145612

Starting off really small here: just introduce the unstable feature and the feature gate, and one of the two traits that the Reborrow experiment deals with.

### Cliff-notes explanation

The `Reborrow` trait is conceptually a close cousin of `Copy` with the exception that it disables the source (`self`) for the lifetime of the target / result of the reborrow action. It can be viewed as a method of `fn reborrow(self: Self<'a>) -> Self<'a>` with the compiler adding tracking of the resulting `Self<'a>` (or any value derived from it that retains the `'a` lifetime) to keep the `self` disabled for reads and writes.

No method is planned to be surfaced to the user, however, as reborrowing cannot be seen in code (except for method calls [`a.foo()` reborrows `a`] and explicit reborrows [`&*a`]) and thus triggering user-code in it could be viewed as "spooky action at a distance". Furthermore, the added compiler tracking cannot be seen on the method itself, violating the Golden Rule. Note that the userland "reborrow" method is not True Reborrowing, but rather a form of a "Fancy Deref":
```rust
fn reborrow(&'short self: Self<'long>) -> Self<'short>;
```
The lifetime shortening is the issue here: a reborrowed `Self` or any value derived from it is bound to the method that called `reborrow`, since `&'short` is effectively a local variable. True Reborrowing does not shorten the lifetime of the result.

To avoid having to introduce new kinds of references, new kinds of lifetime annotations, or a blessed trait method, no method will be introduced at all. Instead, the `Reborrow` trait is intended to be a derived trait that effectively reborrows each field individually; `Copy` fields end up just copying, while fields that themselves `Reborrow` get disabled in the source, usually leading to the source itself being disabled (some differences may appear with structs that contain multiple reborrowable fields). The goal of the experiment is to determine how the actual implementation here will shape out, and what the "bottom case" for the recursive / deriving `Reborrow` is.

`Reborrow` has a friend trait, `CoerceShared`, which is equivalent to a `&'a mut T -> &'a T` conversion. This is needed as a different trait and different operation due to the different semantics it enforces on the source: a `CoerceShared` operation only disables the source for writes / exclusive access for the lifetime of the result. That trait is not yet introduced in this PR, though there is no particular reason why it could not be introduced.
2025-08-22 22:00:55 -04:00
Jacob Pratt
dbc38eed1d Rollup merge of #132087 - ijchen:issue-131770-fix, r=dtolnay
Fix overly restrictive lifetime in `core::panic::Location::file` return type

Fixes #131770 by relaxing the lifetime to match what's stored in the struct. See that issue for more details and discussion.

Since this is a breaking change, I think a crater run is in order. Since this change should only have an effect at compile-time, I think just a check run is sufficient.
2025-08-22 22:00:44 -04:00
okaneco
e42c1b1296 Stabilize round_char_boundary feature 2025-08-22 13:42:38 -04:00
Karol Zwolak
698db13cd0 improve float to_degrees/to_radians rounding comments and impl
* revise comments explaining why we are using literal or expression
* add unspecified precision comments as we don't guarantee precision
* use expression in `f128::to_degrees()`
* make `f64::to_degrees()` impl consistent with other functions
2025-08-22 15:42:01 +02:00
Jacob Pratt
02deabb779 Rollup merge of #145137 - Kmeakin:km/optimize-slice-index-panicking, r=jhpratt
Consolidate panicking functions in `slice/index.rs`

Consolidate all the panicking functions in `slice/index.rs` to use a single `slice_index_fail` function, similar to how it is done in `str/traits.rs`.

Split off from https://github.com/rust-lang/rust/pull/145024
2025-08-21 17:57:51 -04:00
Aapo Alasuutari
5af359162e Introduce Reborrow lang item and trait 2025-08-21 23:53:25 +03:00
Karl Meakin
377a0c88a9 Consolidate panicking functions in slice/index.rs
Consolidate all the panicking functions in `slice/index.rs` to use a single
`slice_index_fail` function, similar to how it is done in `str/traits.rs`.
2025-08-21 11:07:25 +01:00
Jacob Pratt
49eb7810e2 Rollup merge of #145678 - ttajakka:master, r=estebank
Fix typo in docstring

The return type is correct in the source code but incorrect in the docstring.
2025-08-21 01:12:25 -04:00
Jacob Pratt
1d02056329 Rollup merge of #145593 - RalfJung:unsafepinned-raw_get, r=Mark-Simulacrum
UnsafePinned::raw_get: sync signature with get

This was forgotten in https://github.com/rust-lang/rust/pull/142162.

Tracking issue: https://github.com/rust-lang/rust/issues/125735.
2025-08-21 01:12:20 -04:00
Jacob Pratt
8e62f0f0c3 Rollup merge of #143383 - fee1-dead-contrib:push-mstmlwuskxyy, r=dtolnay
stabilize `const_array_each_ref`

cc rust-lang/rust#133289, needs FCP.
2025-08-21 01:12:13 -04:00
ltdk
7c81a067ea Diff-massaging commit 2025-08-20 20:31:33 -04:00
ltdk
2914291e09 Move WTF-8 code from std to core/alloc 2025-08-20 20:31:33 -04:00
ltdk
5a2fceefd3 Copy WTF-8 code into core/alloc (for better diffs) 2025-08-20 20:31:33 -04:00
Tuomas Tajakka
f34fa22740 fix: typo
The return type is correct in the source code but incorrect in the docstring
2025-08-20 22:03:26 +03:00
Scott McMurray
e49d0008f7 Partial-stabilize the basics from bigint_helper_methods 2025-08-20 08:22:46 -07:00
Jacob Pratt
816f098464 Rollup merge of #145626 - folkertdev:prefetch-fallback, r=Amanieu
add a fallback implementation for the `prefetch_*` intrinsics

related ACP: https://github.com/rust-lang/libs-team/issues/638

The fallback is to just ignore the arguments. That is a valid implementation because this intrinsic is just a hint.

I also added the `miri::intrinsic_fallback_is_spec` annotation, so that miri now supports these operations. A prefetch intrinsic call is valid on any pointer. (specifically LLVM guarantees this https://llvm.org/docs/LangRef.html#llvm-prefetch-intrinsic)

Next, I made the `LOCALITY` argument a const generic. That argument must be const (otherwise LLVM crashes), but that was not reflected in the type.

Finally, with these changes, the intrinsic can be safe and `const` (a prefetch at const evaluation time is just a no-op).

cc `@Amanieu`
r? `@RalfJung`
2025-08-20 00:46:02 -04:00
Jacob Pratt
5a0c9386a2 Rollup merge of #145381 - Gnurou:int_lowest_highest_one, r=jhpratt
Implement feature `int_lowest_highest_one` for integer and NonZero types

Tracking issue: rust-lang/rust#145203

Implement the accepted ACP rust-lang/rust#145203 for methods that find the index of the least significant (lowest) and most significant (highest) set bit in an integer for signed, unsigned, and NonZero types.

Also add unit tests for all these types.
2025-08-20 00:45:56 -04:00
Jacob Pratt
a6d648fe79 Rollup merge of #139357 - miried:master, r=Amanieu
Fix parameter order for `_by()` variants of `min` / `max`/ `minmax` in `std::cmp`

We saw a regression introduced in version `1.86` that seems to be coming from switching the order of `v1` and `v2` when calling `comparison` functions in `min_by` / `max_by` / `minmax_by` (cf. this PR: https://github.com/rust-lang/rust/pull/136307)

When the `compare` function is not symmetric in the arguments, this leads to false results. Apparently, the test cases do not cover this scenario currently. While asymmetric comparison may be an edge case, but current behavior is unexpected nevertheless.
2025-08-20 00:45:51 -04:00
Folkert de Vries
d25910eaeb make prefetch intrinsics safe 2025-08-20 00:35:42 +02:00
Folkert de Vries
51df7aabbe add a fallback implementation for the prefetch_* intrinsics
The fallback is to just ignore the arguments. That is a valid implementation because this intrinsic is just a hint.

I also added `miri::intrinsic_fallback_is_spec` annotation, so that miri now supports these operations. A prefetch intrinsic call is valid on any pointer.
2025-08-19 21:17:49 +02:00
许杰友 Jieyou Xu (Joe)
5e979cbfc3 Rollup merge of #145336 - clarfonthey:hidden-unicode, r=ibraheemdev
Hide docs for `core::unicode`

This module is perma-unstable and shouldn't show up in the public docs. If people want to see the docs for it, they can still run `RUSTDOCFLAGS=--document-hidden-items ./x doc library/core`.
2025-08-19 19:42:10 +08:00
许杰友 Jieyou Xu (Joe)
0b378a7108 Rollup merge of #145255 - lune-climate:dec2flt-doc, r=ibraheemdev
dec2flt: Provide more valid inputs examples

I was just looking at the specifics of how the parsing is handled here and I wasn't sure if the examples were incomplete or the grammar below was misleading.

The grammar was correct so I figured I'd add these examples to clarify.
2025-08-19 19:42:09 +08:00
许杰友 Jieyou Xu (Joe)
0b80d406ce Rollup merge of #144767 - tgross35:doc-grammar, r=ibraheemdev
Correct some grammar in integer documentation

Update "between" to "among" (more than two items), connect the "which" dependent clause to the independent part, and remove the redundant "here".
2025-08-19 19:42:04 +08:00
许杰友 Jieyou Xu (Joe)
4327e69030 Rollup merge of #143730 - pascaldekloe:fmt-radix-trim, r=tgross35
fmt of non-decimal radix untangled

Have the implementation match its decimal counterpart.

* Digit table instead of conversion functions
* Correct buffer size per radix
* Elimination of dead code for negative
* No trait abstraction for integers

#### Original Performance
```
    fmt::write_10ints_bin                                                393.03ns/iter      +/- 1.41
    fmt::write_10ints_hex                                                316.84ns/iter      +/- 1.49
    fmt::write_10ints_oct                                                327.16ns/iter      +/- 0.46
```

#### Patched Performance
```
    fmt::write_10ints_bin                                                392.31ns/iter      +/- 3.05
    fmt::write_10ints_hex                                                302.41ns/iter      +/- 5.48
    fmt::write_10ints_oct                                                322.01ns/iter      +/- 3.82
```

r? tgross35
2025-08-19 19:42:03 +08:00
Michael Rieder
36d309e7b9 Merge remote-tracking branch 'upstream/master' 2025-08-19 11:15:52 +02:00
Michael Rieder
41d8d85549 Remove hs_abs_cmp examples 2025-08-19 11:06:45 +02:00