// MIR for `enumerated_loop` after PreCodegen fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); let mut _13: std::slice::Iter<'_, T>; let mut _14: std::iter::Enumerate>; let mut _15: std::iter::Enumerate>; let mut _16: &mut std::iter::Enumerate>; let mut _17: std::option::Option<(usize, &T)>; let mut _18: isize; let mut _21: &impl Fn(usize, &T); let mut _22: (usize, &T); let _23: (); scope 1 { debug iter => _15; let _19: usize; let _20: &T; scope 2 { debug i => _19; debug x => _20; } } scope 3 (inlined core::slice::::iter) { scope 4 (inlined std::slice::Iter::<'_, T>::new) { let _3: usize; let mut _5: std::ptr::NonNull<[T]>; let mut _9: *mut T; let mut _10: *mut T; let mut _12: *const T; scope 5 { let _8: std::ptr::NonNull; scope 6 { let _11: *const T; scope 7 { } scope 12 (inlined without_provenance::) { } scope 13 (inlined NonNull::::as_ptr) { } scope 14 (inlined std::ptr::mut_ptr::::add) { } } scope 8 (inlined as From<&[T]>>::from) { scope 9 (inlined NonNull::<[T]>::from_ref) { let mut _4: *const [T]; } } scope 10 (inlined NonNull::<[T]>::cast::) { let mut _6: *mut [T]; let mut _7: *const T; scope 11 (inlined NonNull::<[T]>::as_ptr) { } } } } } scope 15 (inlined as Iterator>::enumerate) { scope 16 (inlined Enumerate::>::new) { } } scope 17 (inlined > as IntoIterator>::into_iter) { } bb0: { StorageLive(_13); StorageLive(_3); StorageLive(_8); _3 = PtrMetadata(copy _1); StorageLive(_5); StorageLive(_4); _4 = &raw const (*_1); _5 = NonNull::<[T]> { pointer: move _4 }; StorageDead(_4); StorageLive(_6); StorageLive(_7); _6 = copy _5 as *mut [T] (Transmute); _7 = copy _6 as *const T (PtrToPtr); _8 = NonNull:: { pointer: move _7 }; StorageDead(_7); StorageDead(_6); StorageDead(_5); StorageLive(_11); switchInt(const ::IS_ZST) -> [0: bb1, otherwise: bb2]; } bb1: { StorageLive(_10); StorageLive(_9); _9 = copy _8 as *mut T (Transmute); _10 = Offset(copy _9, copy _3); StorageDead(_9); _11 = move _10 as *const T (PtrToPtr); StorageDead(_10); goto -> bb3; } bb2: { _11 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_12); _12 = copy _11; _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_8); StorageDead(_3); _14 = Enumerate::> { iter: copy _13, count: const 0_usize }; StorageDead(_13); StorageLive(_15); _15 = copy _14; goto -> bb4; } bb4: { StorageLive(_17); _16 = &mut _15; _17 = > as Iterator>::next(move _16) -> [return: bb5, unwind: bb11]; } bb5: { _18 = discriminant(_17); switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { StorageDead(_17); StorageDead(_15); drop(_2) -> [return: bb7, unwind continue]; } bb7: { return; } bb8: { _19 = copy (((_17 as Some).0: (usize, &T)).0: usize); _20 = copy (((_17 as Some).0: (usize, &T)).1: &T); StorageLive(_21); _21 = &_2; StorageLive(_22); _22 = (copy _19, copy _20); _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; } bb9: { StorageDead(_22); StorageDead(_21); StorageDead(_17); goto -> bb4; } bb10: { unreachable; } bb11 (cleanup): { drop(_2) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { resume; } }