Skip to content

Commit b81d235

Browse files
authored
Rollup merge of #95532 - RalfJung:utf8_char_counts, r=Dylan-DPC
make utf8_char_counts test faster in Miri This currently takes >3min on GHA, so let's reduce the test size a bit more for Miri.
2 parents f37bca4 + 85bfe2d commit b81d235

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

library/alloc/tests/str.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -2234,11 +2234,14 @@ fn utf8_chars() {
22342234
#[test]
22352235
fn utf8_char_counts() {
22362236
let strs = [("e", 1), ("é", 1), ("€", 1), ("\u{10000}", 1), ("eé€\u{10000}", 4)];
2237-
let mut reps =
2238-
[8, 64, 256, 512, 1024].iter().copied().flat_map(|n| n - 8..=n + 8).collect::<Vec<usize>>();
2237+
let spread = if cfg!(miri) { 4 } else { 8 };
2238+
let mut reps = [8, 64, 256, 512]
2239+
.iter()
2240+
.copied()
2241+
.flat_map(|n| n - spread..=n + spread)
2242+
.collect::<Vec<usize>>();
22392243
if cfg!(not(miri)) {
2240-
let big = 1 << 16;
2241-
reps.extend(big - 8..=big + 8);
2244+
reps.extend([1024, 1 << 16].iter().copied().flat_map(|n| n - spread..=n + spread));
22422245
}
22432246
let counts = if cfg!(miri) { 0..1 } else { 0..8 };
22442247
let padding = counts.map(|len| " ".repeat(len)).collect::<Vec<String>>();

0 commit comments

Comments
 (0)