summary refs log tree commit diff
path: root/src/test/mir-opt/const_prop/repeat.rs
blob: fb091ad2a3d5342d26f25343296b1e7ccea386fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// compile-flags: -O

fn main() {
    let x: u32 = [42; 8][2] + 0;
}

// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
//  bb0: {
//      ...
//      _3 = [const 42u32; 8];
//      ...
//      _4 = const 2usize;
//      _5 = const 8usize;
//      _6 = Lt(_4, _5);
//      assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1;
//  }
//  bb1: {
//      _2 = _3[_4];
//      _1 = Add(move _2, const 0u32);
//      ...
//      return;
//  }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
//  bb0: {
//      ...
//      _6 = const true;
//      assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1;
//  }
//  bb1: {
//      _2 = const 42u32;
//      _1 = Add(move _2, const 0u32);
//      ...
//      return;
//  }
// END rustc.main.ConstProp.after.mir