fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1- // MIR for `main` before ConstProp 2+ // MIR for `main` after ConstProp 3 4 fn main() -> () { 5 let mut _0: (); 6 let _1: i32; 7 let mut _2: (i32, bool); 8 let mut _4: [i32; 6]; 9 let _5: usize; 10 let mut _6: usize; 11 let mut _7: bool; 12 let mut _9: u32; 13 scope 1 { 14 debug x => _1; 15 let _3: i32; 16 scope 2 { 17 debug y => _3; 18 let _8: u32; 19 scope 3 { 20 debug z => _9; 21 } 22 } 23 } 24 25 bb0: { 26 StorageLive(_1); 27- _2 = CheckedAdd(const 2_i32, const 2_i32); 28- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; 29+ _2 = const (4_i32, false); 30+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; 31 } 32 33 bb1: { 34- _1 = move (_2.0: i32); 35+ _1 = const 4_i32; 36 StorageLive(_3); 37 StorageLive(_4); 38 _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; 39 StorageLive(_5); 40 _5 = const 3_usize; 41 _6 = const 6_usize; 42- _7 = Lt(_5, _6); 43- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; 44+ _7 = const true; 45+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; 46 } 47 48 bb2: { 49- _3 = _4[_5]; 50+ _3 = const 3_i32; 51 StorageDead(_5); 52 StorageDead(_4); 53 _9 = const 42_u32; 54 StorageDead(_3); 55 StorageDead(_1); 56 return; 57 } 58+ } 59+ 60+ alloc5 (size: 8, align: 4) { 61+ 04 00 00 00 00 __ __ __ │ .....░░░ 62 } 63