rust/library
bors 5b74275f89 Auto merge of #142294 - GuillaumeGomez:specialize-tostring-on-128-integers, r=tgross35
Use a distinct `ToString` implementation for `u128` and `i128`

Part of https://github.com/rust-lang/rust/issues/135543.

Follow-up of rust-lang/rust#136264.

When working on https://github.com/rust-lang/rust/pull/142098, I realized that `i128` and `u128` could also benefit from a distinct `ToString` implementation so here it.

The last commit is just me realizing that I forgot to add the format tests for `usize` and `isize`.

Here is the bench comparison:

| bench name | last nightly | with this PR | diff |
|-|-|-|-|
| bench_i128 | 29.25 ns/iter (+/- 0.66) | 17.52 ns/iter (+/- 0.7) | -40.1% |
| bench_u128 | 34.06 ns/iter (+/- 0.21) | 16.1 ns/iter (+/- 0.6) | -52.7% |

I used this code to test:

```rust
#![feature(test)]

extern crate test;

use test::{Bencher, black_box};

#[inline(always)]
fn convert_to_string<T: ToString>(n: T) -> String {
    n.to_string()
}

macro_rules! decl_benches {
    ($($name:ident: $ty:ident,)+) => {
        $(
	    #[bench]
            fn $name(c: &mut Bencher) {
                c.iter(|| convert_to_string(black_box({ let nb: $ty = 20; nb })));
            }
	)+
    }
}

decl_benches! {
    bench_u128: u128,
    bench_i128: i128,
}
```
2025-06-20 02:55:43 +00:00
..
alloc Auto merge of #142294 - GuillaumeGomez:specialize-tostring-on-128-integers, r=tgross35 2025-06-20 02:55:43 +00:00
alloctests Auto merge of #142294 - GuillaumeGomez:specialize-tostring-on-128-integers, r=tgross35 2025-06-20 02:55:43 +00:00
backtrace@b65ab935fb Update the backtrace submodule 2025-06-16 07:00:13 +00:00
compiler-builtins Work around out-of-tree testing with a shim crate 2025-06-14 06:56:18 +00:00
core Auto merge of #142294 - GuillaumeGomez:specialize-tostring-on-128-integers, r=tgross35 2025-06-20 02:55:43 +00:00
coretests Add test for new format_args!() temporary lifetimes. 2025-06-18 10:20:20 +02:00
panic_abort Use the in-tree compiler-builtins 2025-06-08 02:36:58 +00:00
panic_unwind Rollup merge of #141993 - tgross35:use-in-tree-builtins, r=bjorn3 2025-06-09 12:17:53 -05:00
portable-simd Merge commit 'c14f2fc3eb' into sync-from-portable-simd-2025-03-19 2025-03-19 00:58:47 -04:00
proc_macro Add support for repetition to proc_macro::quote 2025-06-17 01:36:54 +09:00
profiler_builtins Fix profiler_builtins build script to handle full path to profiler lib 2025-04-11 16:57:38 +02:00
rtstartup library/compiler: add PointeeSized bounds 2025-06-16 23:04:33 +00:00
rustc-std-workspace-alloc Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
rustc-std-workspace-core Use the in-tree compiler-builtins 2025-06-08 02:36:58 +00:00
rustc-std-workspace-std Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
std Auto merge of #141864 - Berrysoft:cygwin-path, r=ChrisDenton 2025-06-19 13:38:37 +00:00
stdarch@1b4d15df12 Update the stdarch submodule 2025-06-12 07:59:13 +00:00
sysroot Update stdarch 2025-05-01 20:01:43 +05:30
test Add new test_main_with_exit_callback public function in libtest to allow a callback to be called before exiting 2025-05-06 18:17:48 +02:00
unwind Upgrade the standard library unwinding version 2025-06-11 20:05:06 +00:00
windows_targets Fix backtrace for cygwin 2025-05-07 13:08:19 +08:00
Cargo.lock Update libc to 0.2.174 2025-06-17 18:03:45 +00:00
Cargo.toml Use the in-tree compiler-builtins 2025-06-08 02:36:58 +00:00