]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs
Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov
[rust.git] / src / test / ui / issues / issue-69225-SCEVAddExpr-wrap-flag.rs
1 // run-fail
2 // compile-flags: -C opt-level=3
3 // error-pattern: index out of bounds: the len is 0 but the index is 16777216
4 // ignore-wasm no panic or subprocess support
5 // ignore-emscripten no panic or subprocess support
6
7 fn do_test(x: usize) {
8     let mut arr = vec![vec![0u8; 3]];
9
10     let mut z = vec![0];
11     for arr_ref in arr.iter_mut() {
12         for y in 0..x {
13             for _ in 0..1 {
14                 z.reserve_exact(x);
15                 let iterator = std::iter::repeat(0).take(x);
16                 let mut cnt = 0;
17                 iterator.for_each(|_| {
18                     z[0] = 0;
19                     cnt += 1;
20                 });
21                 let a = y * x;
22                 let b = (y + 1) * x - 1;
23                 let slice = &mut arr_ref[a..b];
24                 slice[1 << 24] += 1;
25             }
26         }
27     }
28 }
29
30 fn main() {
31     do_test(1);
32     do_test(2);
33 }