fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1- // MIR for `bound` before LowerSliceLenCalls 2+ // MIR for `bound` after LowerSliceLenCalls 3 4 fn bound(_1: usize, _2: &[u8]) -> 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 _7: usize; 13 let mut _8: usize; 14 let mut _9: bool; 15 16 bb0: { 17 StorageLive(_3); 18 StorageLive(_4); 19 _4 = _1; 20 StorageLive(_5); 21 StorageLive(_6); 22 _6 = &(*_2); 23- _5 = core::slice::<impl [u8]>::len(move _6) -> [return: bb1, unwind continue]; 24+ _5 = Len((*_6)); 25+ goto -> bb1; 26 } 27 28 bb1: { 29 StorageDead(_6); 30 _3 = Lt(move _4, move _5); 31 switchInt(move _3) -> [0: bb4, otherwise: bb2]; 32 } 33 34 bb2: { 35 StorageDead(_5); 36 StorageDead(_4); 37 StorageLive(_7); 38 _7 = _1; 39 _8 = Len((*_2)); 40 _9 = Lt(_7, _8); 41 assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind continue]; 42 } 43 44 bb3: { 45 _0 = (*_2)[_7]; 46 StorageDead(_7); 47 goto -> bb5; 48 } 49 50 bb4: { 51 StorageDead(_5); 52 StorageDead(_4); 53 _0 = const 42_u8; 54 goto -> bb5; 55 } 56 57 bb5: { 58 StorageDead(_3); 59 return; 60 } 61 } 62