// 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: usize; let mut _9: std::option::Option; let mut _11: bool; let mut _13: &impl Fn(usize, &T); let mut _14: (usize, &T); let _15: (); scope 1 { debug ((iter: std::ops::Range).0: usize) => _4; debug ((iter: std::ops::Range).1: usize) => _3; let _10: usize; scope 2 { debug i => _10; let _12: &T; scope 3 { debug x => _12; } } scope 5 (inlined iter::range::>::next) { scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { let mut _6: bool; let _7: usize; let mut _8: usize; scope 7 { scope 9 (inlined ::forward_unchecked) { scope 10 (inlined core::num::::unchecked_add) { scope 11 (inlined core::ub_checks::check_language_ub) { scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } } } scope 8 (inlined std::cmp::impls::::lt) { let mut _5: usize; } } } } scope 4 (inlined as IntoIterator>::into_iter) { } bb0: { _3 = PtrMetadata(copy _1); StorageLive(_4); _4 = const 0_usize; goto -> bb1; } bb1: { StorageLive(_9); StorageLive(_6); StorageLive(_5); _5 = copy _4; _6 = Lt(move _5, copy _3); StorageDead(_5); switchInt(move _6) -> [0: bb2, otherwise: bb4]; } bb2: { StorageDead(_6); StorageDead(_9); StorageDead(_4); drop(_2) -> [return: bb3, unwind continue]; } bb3: { return; } bb4: { _7 = copy _4; StorageLive(_8); _8 = AddUnchecked(copy _7, const 1_usize); _4 = move _8; StorageDead(_8); _9 = Option::::Some(copy _7); StorageDead(_6); _10 = copy ((_9 as Some).0: usize); _11 = Lt(copy _10, copy _3); assert(move _11, "index out of bounds: the length is {} but the index is {}", copy _3, copy _10) -> [success: bb5, unwind: bb7]; } bb5: { _12 = &(*_1)[_10]; StorageLive(_13); _13 = &_2; StorageLive(_14); _14 = (copy _10, copy _12); _15 = >::call(move _13, move _14) -> [return: bb6, unwind: bb7]; } bb6: { StorageDead(_14); StorageDead(_13); StorageDead(_9); goto -> bb1; } bb7 (cleanup): { drop(_2) -> [return: bb8, unwind terminate(cleanup)]; } bb8 (cleanup): { resume; } }