]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/const_prop/array_index.rs
Rollup merge of #60959 - petrochenkov:sassert, r=estebank
[rust.git] / src / test / mir-opt / const_prop / array_index.rs
1 fn main() {
2     let x: u32 = [0, 1, 2, 3][2];
3 }
4
5 // END RUST SOURCE
6 // START rustc.main.ConstProp.before.mir
7 //  bb0: {
8 //      ...
9 //      _2 = [const 0u32, const 1u32, const 2u32, const 3u32];
10 //      ...
11 //      _3 = const 2usize;
12 //      _4 = const 4usize;
13 //      _5 = Lt(_3, _4);
14 //      assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1;
15 //  }
16 //  bb1: {
17 //      _1 = _2[_3];
18 //      ...
19 //      return;
20 //  }
21 // END rustc.main.ConstProp.before.mir
22 // START rustc.main.ConstProp.after.mir
23 //  bb0: {
24 //      ...
25 //      _5 = const true;
26 //      assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1;
27 //  }
28 //  bb1: {
29 //      _1 = _2[_3];
30 //      ...
31 //      return;
32 //  }
33 // END rustc.main.ConstProp.after.mir