// MIR for `range_loop` after PreCodegen fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:26: +0:31 debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:42: +0:43 let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:65: +0:65 let mut _3: usize; // in scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 let mut _4: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 let mut _5: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 let mut _12: std::option::Option; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 let mut _15: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6 let mut _17: usize; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 let mut _18: bool; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 let mut _20: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10 let mut _21: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16 let _22: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 scope 1 { debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 let _16: usize; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 scope 2 { debug i => _16; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 let _19: &T; // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14 scope 3 { debug x => _19; // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14 } } scope 5 (inlined iter::range::>::next) { // at $DIR/slice_iter.rs:49:14: 49:28 debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL debug self => _6; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL let mut _7: &usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL let mut _8: &usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL let mut _11: bool; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL let _13: usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL let mut _14: usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL scope 7 { debug old => _13; // in scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL scope 8 { } } scope 9 (inlined cmp::impls::::lt) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL debug self => _7; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL debug other => _8; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL let mut _9: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL let mut _10: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL } } } } scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:49:14: 49:28 debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } bb0: { StorageLive(_3); // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 _3 = Len((*_1)); // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 StorageDead(_3); // scope 0 at $DIR/slice_iter.rs:+1:27: +1:28 StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 _5 = move _4; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 } bb1: { StorageLive(_12); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 _6 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 StorageLive(_13); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageLive(_11); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageLive(_7); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL _7 = &((*_6).0: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageLive(_8); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL _8 = &((*_6).1: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageLive(_9); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL _9 = (*_7); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_10); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL _10 = (*_8); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL _11 = Lt(move _9, move _10); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_10); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_9); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_8); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageDead(_7); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL switchInt(move _11) -> [0: bb2, otherwise: bb3]; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb2: { _12 = Option::::None; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL goto -> bb5; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb3: { _13 = ((*_6).0: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageLive(_14); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12]; // scope 8 at $SRC_DIR/core/src/iter/range.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL // + literal: Const { ty: unsafe fn(usize, usize) -> usize {::forward_unchecked}, val: Value() } } bb4: { ((*_6).0: usize) = move _14; // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageDead(_14); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL _12 = Option::::Some(_13); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL goto -> bb5; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb5: { StorageDead(_11); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL StorageDead(_13); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL _15 = discriminant(_12); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 } bb6: { StorageDead(_12); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+4:5: +4:6 drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 } bb7: { return; // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2 } bb8: { _16 = ((_12 as Some).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 _17 = Len((*_1)); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 _18 = Lt(_16, _17); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 } bb9: { _19 = &(*_1)[_16]; // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26 StorageLive(_20); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 _20 = &_2; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 StorageLive(_21); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 _21 = (_16, _19); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 _22 = >::call(move _20, move _21) -> [return: bb10, unwind: bb12]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 // mir::Constant // + span: $DIR/slice_iter.rs:51:9: 51:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } } bb10: { StorageDead(_21); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 StorageDead(_20); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 StorageDead(_12); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 } bb11: { unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 } bb12 (cleanup): { drop(_2) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 } bb13 (cleanup): { resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +5:2 } }