// MIR for `range_loop` after PreCodegen fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); let mut _3: usize; let mut _4: std::ops::Range; let mut _5: std::ops::Range; let mut _6: &mut std::ops::Range; let mut _14: std::option::Option; let mut _16: usize; let mut _17: bool; let mut _19: &impl Fn(usize, &T); let mut _20: (usize, &T); let _21: (); scope 1 { debug iter => _5; let _15: usize; scope 2 { debug i => _15; let _18: &T; scope 3 { debug x => _18; } } scope 5 (inlined iter::range::>::next) { debug self => _6; scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { debug self => _6; let mut _7: &usize; let mut _8: &usize; let mut _11: bool; let _12: usize; let mut _13: usize; scope 7 { debug old => _12; scope 8 { } } scope 9 (inlined std::cmp::impls::::lt) { debug self => _7; debug other => _8; let mut _9: usize; let mut _10: usize; } } } } scope 4 (inlined as IntoIterator>::into_iter) { debug self => _4; } bb0: { StorageLive(_3); _3 = Len((*_1)); _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; StorageDead(_3); StorageLive(_5); _5 = _4; goto -> bb1; } bb1: { StorageLive(_14); _6 = &mut _5; StorageLive(_12); StorageLive(_11); StorageLive(_7); _7 = &(_5.0: usize); StorageLive(_8); _8 = &(_5.1: usize); StorageLive(_9); _9 = (_5.0: usize); StorageLive(_10); _10 = (_5.1: usize); _11 = Lt(move _9, move _10); StorageDead(_10); StorageDead(_9); switchInt(move _11) -> [0: bb2, otherwise: bb4]; } bb2: { StorageDead(_8); StorageDead(_7); StorageDead(_11); StorageDead(_12); StorageDead(_14); StorageDead(_5); drop(_2) -> [return: bb3, unwind unreachable]; } bb3: { return; } bb4: { StorageDead(_8); StorageDead(_7); _12 = (_5.0: usize); StorageLive(_13); _13 = ::forward_unchecked(_12, const 1_usize) -> [return: bb5, unwind unreachable]; } bb5: { (_5.0: usize) = move _13; StorageDead(_13); _14 = Option::::Some(_12); StorageDead(_11); StorageDead(_12); _15 = ((_14 as Some).0: usize); _16 = Len((*_1)); _17 = Lt(_15, _16); assert(move _17, "index out of bounds: the length is {} but the index is {}", move _16, _15) -> [success: bb6, unwind unreachable]; } bb6: { _18 = &(*_1)[_15]; StorageLive(_19); _19 = &_2; StorageLive(_20); _20 = (_15, _18); _21 = >::call(move _19, move _20) -> [return: bb7, unwind unreachable]; } bb7: { StorageDead(_20); StorageDead(_19); StorageDead(_14); goto -> bb1; } }