26 Commits

Author SHA1 Message Date
Trevor Gross
52758b7329
Rollup merge of #142668 - hkBst:less-static-mut, r=tgross35
vec_deque/fmt/vec tests: remove static mut

More rust-lang/rust#125035.

r? ```@tgross35```
2025-06-20 02:50:39 -04:00
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
Marijn Schouten
456c9da45a vec_deque alloctests: remove static mut 2025-06-19 11:51:47 +00:00
Marijn Schouten
ecdf220dbc vec tests: remove static mut 2025-06-19 11:39:21 +00:00
Marijn Schouten
2c434edf24 remove duplicate crash test 2025-06-18 14:04:02 +00:00
Marijn Schouten
021bcb9b4c fmt tests: remove static mut 2025-06-18 12:29:22 +00:00
Guillaume Gomez
9b09948897 Extend num tests on usize and isize as well 2025-06-16 11:54:15 +02:00
Jubilee
b38ee5e689
Rollup merge of #142046 - Qelxiros:122742-vec_peek_mut, r=cuviper
add Vec::peek_mut

Tracking issue: rust-lang/rust#122742
2025-06-13 20:59:16 -07:00
Matthias Krüger
315b76fcd3
Rollup merge of #138016 - nwoods-cimpress:slice_chunkby_clone, r=dtolnay
Added `Clone` implementation for `ChunkBy`

Added `Clone` implementation for `ChunkBy`

Closes rust-lang/rust#137969.
2025-06-12 20:03:34 +02:00
Jeremy Smart
9d19cbe29b
update docs, test 2025-06-11 22:57:57 -04:00
Jeremy Smart
cc80429021
fix tests 2025-06-06 19:22:15 -04:00
Jeremy Smart
188c40126d
add Vec::peek_mut 2025-06-04 18:15:12 -04:00
Sidney Cammeresi
1ae96fcd79 Update tests with Range parameter to BTreeMap::extract_if etc. 2025-05-27 08:31:56 -07:00
Pietro Albini
2ce08ca5d6
update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
Vladimir Krivopalov
cdf4143eb8 Implement VecDeque::truncate_front()
Tracking issue: #140667

Signed-off-by: Vladimir Krivopalov <vladimir.krivopalov@gmail.com>
2025-05-05 11:13:26 -04:00
bendn
c8c074288a
Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc 2025-04-24 13:14:36 +07:00
Tamir Duberstein
9058bab9a9
Move <CStr as Debug> test to coretests 2025-04-18 10:31:55 -04:00
Stuart Cook
338b8787b9
Rollup merge of #138546 - GuillaumeGomez:integer-to-string-tests, r=Amanieu
Add integer to string formatting tests

As discussed in https://github.com/rust-lang/rust/pull/136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? `````@Mark-Simulacrum`````
2025-04-05 13:18:14 +11:00
Frank King
5004e10ceb Add a test for Weak created from UniqueArc::downgrade 2025-03-29 12:13:38 +08:00
Guillaume Gomez
25900c2768 Tweak integer to string conversion test a bit to be future-proof 2025-03-23 22:34:05 +01:00
Frank King
5016467a23 Implement UniqueArc 2025-03-22 15:14:49 +08:00
Guillaume Gomez
bacd57a583 Add integer to string formatting tests 2025-03-16 14:45:19 +01:00
Nathaniel Woods
8bbc080cc7 Added Clone implementation for ChunkBy 2025-03-10 11:12:26 -04:00
bjorn3
701bedc323 Move last remaining Rc test to alloctests 2025-03-07 19:11:13 +00:00
bjorn3
be1e0b786d Move most Rc tests to alloctests 2025-03-07 19:11:13 +00:00
bjorn3
fb04372dc5 Move all alloc integration tests to a new alloctests crate 2025-03-07 19:11:11 +00:00