fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1- // MIR for `array_bound_mut` before NormalizeArrayLen 2+ // MIR for `array_bound_mut` after NormalizeArrayLen 3 4 fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 { 5 debug index => _1; 6 debug slice => _2; 7 let mut _0: u8; 8 let mut _3: bool; 9 let mut _4: usize; 10 let mut _5: usize; 11 let mut _6: &[u8]; 12 let mut _7: &[u8; N]; 13 let _8: usize; 14 let mut _9: usize; 15 let mut _10: bool; 16 let _11: usize; 17 let mut _12: usize; 18 let mut _13: bool; 19 20 bb0: { 21 StorageLive(_3); 22 StorageLive(_4); 23 _4 = _1; 24 StorageLive(_5); 25 StorageLive(_6); 26 StorageLive(_7); 27 _7 = &(*_2); 28 _6 = move _7 as &[u8] (PointerCoercion(Unsize)); 29 StorageDead(_7); 30- _5 = Len((*_6)); 31+ _5 = const N; 32 goto -> bb1; 33 } 34 35 bb1: { 36 StorageDead(_6); 37 _3 = Lt(move _4, move _5); 38 switchInt(move _3) -> [0: bb4, otherwise: bb2]; 39 } 40 41 bb2: { 42 StorageDead(_5); 43 StorageDead(_4); 44 StorageLive(_8); 45 _8 = _1; 46 _9 = Len((*_2)); 47 _10 = Lt(_8, _9); 48 assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; 49 } 50 51 bb3: { 52 _0 = (*_2)[_8]; 53 StorageDead(_8); 54 goto -> bb6; 55 } 56 57 bb4: { 58 StorageDead(_5); 59 StorageDead(_4); 60 StorageLive(_11); 61 _11 = const 0_usize; 62 _12 = Len((*_2)); 63 _13 = Lt(_11, _12); 64 assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind continue]; 65 } 66 67 bb5: { 68 (*_2)[_11] = const 42_u8; 69 StorageDead(_11); 70 _0 = const 42_u8; 71 goto -> bb6; 72 } 73 74 bb6: { 75 StorageDead(_3); 76 return; 77 } 78 } 79