blob: 3435ca07f4cd8414c8c6894be6619bd9e1a5a3fb (
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
|
fn test() -> &'static [u32] {
&[1, 2]
}
fn main() {
let x = test()[0];
}
// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
// bb1: {
// ...
// _3 = const 0usize;
// _4 = Len((*_2));
// _5 = Lt(_3, _4);
// assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb2;
// }
// bb2: {
// _1 = (*_2)[_3];
// ...
// return;
// }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
// bb0: {
// ...
// _3 = const 0usize;
// _4 = Len((*_2));
// _5 = Lt(_3, _4);
// assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb2;
// }
// bb2: {
// _1 = (*_2)[_3];
// ...
// return;
// }
// END rustc.main.ConstProp.after.mir
|