// 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 _9: std::option::Option; let mut _12: isize; let mut _14: usize; let mut _15: bool; let mut _17: &impl Fn(usize, &T); let mut _18: (usize, &T); let _19: (); let mut _20: &mut std::ops::Range; scope 1 { debug iter => _5; let _13: usize; scope 2 { debug i => _13; let _16: &T; scope 3 { debug x => _16; } } scope 5 (inlined iter::range::>::next) { debug self => _20; scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { debug self => _20; let mut _8: bool; let _10: usize; let mut _11: usize; let mut _21: &usize; let mut _22: &usize; scope 7 { debug old => _10; scope 8 { } } scope 9 (inlined cmp::impls::::lt) { debug self => _21; debug other => _22; let mut _6: usize; let mut _7: 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 = move _4; goto -> bb1; } bb1: { StorageLive(_9); StorageLive(_10); StorageLive(_8); StorageLive(_21); StorageLive(_22); StorageLive(_6); _6 = (_5.0: usize); StorageLive(_7); _7 = (_5.1: usize); _8 = Lt(move _6, move _7); StorageDead(_7); StorageDead(_6); switchInt(move _8) -> [0: bb2, otherwise: bb3]; } bb2: { StorageDead(_22); StorageDead(_21); _9 = Option::::None; goto -> bb5; } bb3: { StorageDead(_22); StorageDead(_21); _10 = (_5.0: usize); StorageLive(_11); _11 = ::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { (_5.0: usize) = move _11; StorageDead(_11); _9 = Option::::Some(_10); goto -> bb5; } bb5: { StorageDead(_8); StorageDead(_10); _12 = discriminant(_9); switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { StorageDead(_9); StorageDead(_5); drop(_2) -> [return: bb7, unwind unreachable]; } bb7: { return; } bb8: { _13 = ((_9 as Some).0: usize); _14 = Len((*_1)); _15 = Lt(_13, _14); assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable]; } bb9: { _16 = &(*_1)[_13]; StorageLive(_17); _17 = &_2; StorageLive(_18); _18 = (_13, _16); _19 = >::call(move _17, move _18) -> [return: bb10, unwind unreachable]; } bb10: { StorageDead(_18); StorageDead(_17); StorageDead(_9); goto -> bb1; } bb11: { unreachable; } }