diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir new file mode 100644 index 00000000000..ab07b053536 --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir @@ -0,0 +1,102 @@ +// MIR for `filter_mapped` after PreCodegen + +fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () { + debug iter => _1; // in scope 0 at $DIR/loops.rs:+0:28: +0:32 + debug f => _2; // in scope 0 at $DIR/loops.rs:+0:59: +0:60 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:87: +0:87 + let mut _3: std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _4: std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _5: std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _6: &mut std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _9: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _10: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _12: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:32 + let _11: U; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug x => _11; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + scope 4 (inlined , impl Fn(T) -> Option> as Iterator>::next) { // at $DIR/loops.rs:19:14: 19:32 + debug self => _6; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + let mut _7: &mut impl Iterator; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + let mut _8: &mut impl Fn(T) -> Option; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + } + } + scope 3 (inlined , impl Fn(T) -> Option> as IntoIterator>::into_iter) { // at $DIR/loops.rs:19:14: 19:32 + debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/loops.rs:+1:14: +1:32 + StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:32 + _3 = as Iterator>::filter_map:: Option>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:32 + // mir::Constant + // + span: $DIR/loops.rs:19:19: 19:29 + // + literal: Const { ty: fn(impl Iterator, impl Fn(T) -> Option) -> FilterMap, impl Fn(T) -> Option> { as Iterator>::filter_map:: Option>}, val: Value() } + } + + bb1: { + _4 = move _3; // scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:31: +1:32 + StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:32 + _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:32 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb2: { + StorageLive(_9); // scope 1 at $DIR/loops.rs:+1:14: +1:32 + _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:32 + StorageLive(_7); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _7 = &mut ((*_6).0: impl Iterator); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _8 = &mut ((*_6).1: impl Fn(T) -> Option); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _9 = as Iterator>::find_map:: Option>(move _7, move _8) -> [return: bb3, unwind: bb9]; // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut impl Iterator, &mut impl Fn(T) -> Option) -> Option { as Iterator>::find_map:: Option>}, val: Value() } + } + + bb3: { + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + StorageDead(_7); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _10 = discriminant(_9); // scope 1 at $DIR/loops.rs:+1:14: +1:32 + switchInt(move _10) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:32 + } + + bb4: { + StorageDead(_9); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + drop(_5) -> bb5; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb5: { + StorageDead(_5); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_4); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 + } + + bb6: { + _11 = move ((_9 as Some).0: U); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _12 = opaque::(move _11) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:20:9: 20:15 + // + literal: Const { ty: fn(U) {opaque::}, val: Value() } + } + + bb7: { + StorageDead(_9); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:32 + } + + bb9 (cleanup): { + drop(_5) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir new file mode 100644 index 00000000000..93a34e1ebde --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -0,0 +1,91 @@ +// MIR for `mapped` after PreCodegen + +fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { + debug iter => _1; // in scope 0 at $DIR/loops.rs:+0:21: +0:25 + debug f => _2; // in scope 0 at $DIR/loops.rs:+0:52: +0:53 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:72: +0:72 + let mut _3: std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _4: std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _5: std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _6: &mut std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _7: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _8: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _10: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:25 + let _9: U; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug x => _9; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + } + scope 3 (inlined , impl Fn(T) -> U> as IntoIterator>::into_iter) { // at $DIR/loops.rs:13:14: 13:25 + debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/loops.rs:+1:14: +1:25 + StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:25 + _3 = as Iterator>::map:: U>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:25 + // mir::Constant + // + span: $DIR/loops.rs:13:19: 13:22 + // + literal: Const { ty: fn(impl Iterator, impl Fn(T) -> U) -> Map, impl Fn(T) -> U> { as Iterator>::map:: U>}, val: Value() } + } + + bb1: { + _4 = move _3; // scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:24: +1:25 + StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:25 + _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:25 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb2: { + StorageLive(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:25 + _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + _7 = , impl Fn(T) -> U> as Iterator>::next(_6) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + // mir::Constant + // + span: $DIR/loops.rs:13:14: 13:25 + // + literal: Const { ty: for<'a> fn(&'a mut Map, impl Fn(T) -> U>) -> Option<, impl Fn(T) -> U> as Iterator>::Item> {, impl Fn(T) -> U> as Iterator>::next}, val: Value() } + } + + bb3: { + _8 = discriminant(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:25 + switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + } + + bb4: { + StorageDead(_7); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + drop(_5) -> bb5; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb5: { + StorageDead(_5); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_4); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 + } + + bb6: { + _9 = move ((_7 as Some).0: U); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _10 = opaque::(move _9) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:14:9: 14:15 + // + literal: Const { ty: fn(U) {opaque::}, val: Value() } + } + + bb7: { + StorageDead(_7); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + } + + bb9 (cleanup): { + drop(_5) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs index a09fcd9c990..605cf9a324d 100644 --- a/tests/mir-opt/pre-codegen/loops.rs +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -9,32 +9,15 @@ pub fn int_range(start: usize, end: usize) { } } -pub fn vec_range(mut v: Vec) { - for i in 0..v.len() { - let x = &mut v[i]; - opaque((i, x)) - } - for i in 0..v.len() { - let x = &v[i]; - opaque((i, x)) - } -} - -pub fn vec_iter(mut v: Vec) { - for x in v.iter_mut() { - opaque(x) - } - for x in v.iter() { +pub fn mapped(iter: impl Iterator, f: impl Fn(T) -> U) { + for x in iter.map(f) { opaque(x) } } -pub fn vec_iter_enumerate(mut v: Vec) { - for (i, x) in v.iter_mut().enumerate() { - opaque((i, x)) - } - for (i, x) in v.iter().enumerate() { - opaque((i, x)) +pub fn filter_mapped(iter: impl Iterator, f: impl Fn(T) -> Option) { + for x in iter.filter_map(f) { + opaque(x) } } @@ -48,7 +31,6 @@ pub fn vec_move(mut v: Vec) { fn opaque(_: impl Sized) {} // EMIT_MIR loops.int_range.PreCodegen.after.mir -// EMIT_MIR loops.vec_range.PreCodegen.after.mir -// EMIT_MIR loops.vec_iter.PreCodegen.after.mir -// EMIT_MIR loops.vec_iter_enumerate.PreCodegen.after.mir +// EMIT_MIR loops.mapped.PreCodegen.after.mir +// EMIT_MIR loops.filter_mapped.PreCodegen.after.mir // EMIT_MIR loops.vec_move.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir deleted file mode 100644 index 5fdd0363f3c..00000000000 --- a/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir +++ /dev/null @@ -1,570 +0,0 @@ -// MIR for `vec_iter` after PreCodegen - -fn vec_iter(_1: Vec) -> () { - debug v => _1; // in scope 0 at $DIR/loops.rs:+0:17: +0:22 - let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:41: +0:41 - let mut _2: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _14: &mut [impl Sized]; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _26: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _27: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _28: &mut std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _29: std::option::Option<&mut impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _30: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 - let mut _31: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let _43: &[impl Sized]; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _54: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _55: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _56: &mut std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _57: std::option::Option<&impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _58: isize; // in scope 0 at $DIR/loops.rs:+4:5: +6:6 - let _60: (); // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let _62: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - scope 1 { - debug iter => _27; // in scope 1 at $DIR/loops.rs:+1:14: +1:26 - let _61: &mut impl Sized; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 - scope 2 { - debug x => _61; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 - } - } - scope 3 { - debug iter => _55; // in scope 3 at $DIR/loops.rs:+4:14: +4:22 - let _59: &impl Sized; // in scope 3 at $DIR/loops.rs:+4:9: +4:10 - scope 4 { - debug x => _59; // in scope 4 at $DIR/loops.rs:+4:9: +4:10 - } - } - scope 5 (inlined as DerefMut>::deref_mut) { // at $DIR/loops.rs:24:14: 24:26 - debug self => _2; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _7: *mut impl Sized; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _8: usize; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 6 { - scope 7 (inlined Vec::::as_mut_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _3: &alloc::raw_vec::RawVec; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 8 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _3; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _4: std::ptr::Unique; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 9 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _4; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _5: std::ptr::NonNull; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 10 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _5; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _6: *const impl Sized; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 11 (inlined std::slice::from_raw_parts_mut::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _7; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _8; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _13: *mut [impl Sized]; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _63: *mut impl Sized; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _64: usize; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 12 { - scope 13 (inlined std::slice::from_raw_parts_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _63; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _64; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 14 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _64; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 15 { - debug max_len => const _; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 16 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _7; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _8; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _9: *mut (); // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 17 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _7; // in scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - scope 18 (inlined std::ptr::from_raw_parts_mut::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _9; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _8; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _10: *const (); // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _11: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _12: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 19 { - } - } - } - } - } - } - } - scope 20 (inlined core::slice::::iter_mut) { // at $DIR/loops.rs:24:16: 24:26 - debug self => _14; // in scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 21 (inlined std::slice::IterMut::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _14; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _16: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _17: bool; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _18: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _19: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _21: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _22: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _24: std::ptr::NonNull; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _25: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 22 { - debug ptr => _16; // in scope 22 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 23 { - let _20: *mut impl Sized; // in scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 24 { - debug end => _20; // in scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 30 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _16; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _23: *const impl Sized; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _65: *mut impl Sized; // in scope 30 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 31 { - scope 32 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _65; // in scope 32 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 33 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _65; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _66: *mut u8; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 34 { - scope 35 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _66; // in scope 35 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 36 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _66; // in scope 36 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 37 { - scope 38 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _66; // in scope 38 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 26 (inlined invalid_mut::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _22; // in scope 26 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 27 { - } - } - scope 28 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _16; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug count => _19; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 29 { - } - } - } - } - scope 25 (inlined core::slice::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _14; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _15: *mut [impl Sized]; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 39 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:24:14: 24:26 - debug self => _26; // in scope 39 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - scope 40 (inlined as Deref>::deref) { // at $DIR/loops.rs:27:14: 27:22 - debug self => _31; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _37: *const impl Sized; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _38: usize; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 41 { - scope 42 (inlined Vec::::as_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _31; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _32: &alloc::raw_vec::RawVec; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _36: *mut impl Sized; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 43 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _32; // in scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _33: std::ptr::Unique; // in scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 44 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _33; // in scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _34: std::ptr::NonNull; // in scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 45 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _34; // in scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _35: *const impl Sized; // in scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 46 (inlined std::slice::from_raw_parts::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _37; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _38; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let _42: *const [impl Sized]; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _67: *const impl Sized; // in scope 46 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _68: usize; // in scope 46 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 47 { - scope 48 (inlined std::slice::from_raw_parts::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _67; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _68; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 49 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _68; // in scope 49 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 50 { - debug max_len => const _; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 51 (inlined slice_from_raw_parts::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _37; // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _38; // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _39: *const (); // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 52 (inlined ptr::const_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _37; // in scope 52 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - } - scope 53 (inlined std::ptr::from_raw_parts::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _39; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _38; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _40: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _41: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 54 { - } - } - } - } - } - } - } - scope 55 (inlined core::slice::::iter) { // at $DIR/loops.rs:27:16: 27:22 - debug self => _43; // in scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 56 (inlined std::slice::Iter::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _43; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _45: *const impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _46: bool; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _47: usize; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _49: usize; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _50: *mut impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _52: std::ptr::NonNull; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _53: *const impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 57 { - debug ptr => _45; // in scope 57 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 58 { - let _48: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 59 { - debug end => _48; // in scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 65 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _50; // in scope 65 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _51: *const impl Sized; // in scope 65 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _69: *mut impl Sized; // in scope 65 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 66 { - scope 67 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _69; // in scope 67 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 68 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _69; // in scope 68 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _70: *mut u8; // in scope 68 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 69 { - scope 70 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _70; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 71 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _70; // in scope 71 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 72 { - scope 73 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _70; // in scope 73 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 61 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _49; // in scope 61 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 62 { - } - } - scope 63 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _45; // in scope 63 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - debug count => _47; // in scope 63 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - scope 64 { - } - } - } - } - scope 60 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _43; // in scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _44: *const [impl Sized]; // in scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 74 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:27:14: 27:22 - debug self => _54; // in scope 74 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:26 - _2 = &mut _1; // scope 0 at $DIR/loops.rs:+1:14: +1:26 - StorageLive(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _3 = &((*_2).0: alloc::raw_vec::RawVec); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _4 = ((*_3).0: std::ptr::Unique); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _5 = (_4.0: std::ptr::NonNull); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _6 = (_5.0: *const impl Sized); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _7 = move _6 as *mut impl Sized (PtrToPtr); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageDead(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _8 = ((*_2).1: usize); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_63); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_64); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _9 = _7 as *mut () (PtrToPtr); // scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_12); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _11 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: move _10, metadata: _8 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _12 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _11 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _13 = (_12.1: *mut [impl Sized]); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_12); // scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _14 = &mut (*_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_13); // scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_64); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_63); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 - StorageLive(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _15 = &raw mut (*_14); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _16 = move _15 as *mut impl Sized (PtrToPtr); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _17 = const _; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _17) -> [0: bb1, otherwise: bb2]; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb1: { - StorageLive(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _18 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _19 = Len((*_18)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = Offset(_16, _19); // scope 29 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb2: { - StorageLive(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _21 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _22 = Len((*_21)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = _22 as *mut impl Sized (Transmute); // scope 27 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb3: { - StorageDead(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_65); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_66); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _23 = _16 as *const impl Sized (Pointer(MutToConstPointer)); // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _24 = NonNull:: { pointer: _23 }; // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_66); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_65); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _25 = _20; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _26 = std::slice::IterMut::<'_, impl Sized> { ptr: move _24, end: move _25, _marker: const ZeroSized: PhantomData<&mut impl Sized> }; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&mut impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_27); // scope 0 at $DIR/loops.rs:+1:14: +1:26 - _27 = move _26; // scope 0 at $DIR/loops.rs:+1:14: +1:26 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb4: { - StorageLive(_29); // scope 1 at $DIR/loops.rs:+1:14: +1:26 - _28 = &mut _27; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - _29 = as Iterator>::next(_28) -> [return: bb5, unwind: bb19]; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - // mir::Constant - // + span: $DIR/loops.rs:24:14: 24:26 - // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, impl Sized>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } - } - - bb5: { - _30 = discriminant(_29); // scope 1 at $DIR/loops.rs:+1:14: +1:26 - switchInt(move _30) -> [0: bb6, 1: bb16, otherwise: bb18]; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - } - - bb6: { - StorageDead(_29); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - StorageDead(_27); // scope 0 at $DIR/loops.rs:+3:5: +3:6 - StorageLive(_31); // scope 0 at $DIR/loops.rs:+4:14: +4:22 - _31 = &_1; // scope 0 at $DIR/loops.rs:+4:14: +4:22 - StorageLive(_37); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_36); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_32); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _32 = &((*_31).0: alloc::raw_vec::RawVec); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_33); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _33 = ((*_32).0: std::ptr::Unique); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_34); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _34 = (_33.0: std::ptr::NonNull); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_35); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _35 = (_34.0: *const impl Sized); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _36 = move _35 as *mut impl Sized (PtrToPtr); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_35); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_34); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_33); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _37 = move _36 as *const impl Sized (Pointer(MutToConstPointer)); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_32); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_36); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_38); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _38 = ((*_31).1: usize); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_67); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_68); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_42); // scope 47 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_39); // scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _39 = _37 as *const () (PtrToPtr); // scope 52 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageLive(_41); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_40); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _40 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: _39, metadata: _38 }; // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _41 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _40 }; // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_40); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _42 = (_41.0: *const [impl Sized]); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_41); // scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_39); // scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _43 = &(*_42); // scope 47 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_42); // scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_68); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_67); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_38); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_37); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_31); // scope 0 at $DIR/loops.rs:+4:14: +4:15 - StorageLive(_45); // scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_44); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _44 = &raw const (*_43); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _45 = move _44 as *const impl Sized (PtrToPtr); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_44); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_48); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_46); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _46 = const _; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _46) -> [0: bb7, otherwise: bb8]; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb7: { - StorageLive(_47); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _47 = Len((*_43)); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _48 = Offset(_45, _47); // scope 64 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageDead(_47); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb8: { - StorageLive(_49); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _49 = Len((*_43)); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _48 = _49 as *const impl Sized (Transmute); // scope 62 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_49); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb9: { - StorageDead(_46); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_52); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_50); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _50 = _45 as *mut impl Sized (PtrToPtr); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_51); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_69); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_70); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _51 = _50 as *const impl Sized (Pointer(MutToConstPointer)); // scope 66 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _52 = NonNull:: { pointer: _51 }; // scope 66 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_70); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_69); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_51); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_50); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_53); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _53 = _48; // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _54 = std::slice::Iter::<'_, impl Sized> { ptr: move _52, end: move _53, _marker: const ZeroSized: PhantomData<&impl Sized> }; // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_53); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_52); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_48); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_45); // scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_55); // scope 0 at $DIR/loops.rs:+4:14: +4:22 - _55 = move _54; // scope 0 at $DIR/loops.rs:+4:14: +4:22 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb10: { - StorageLive(_57); // scope 3 at $DIR/loops.rs:+4:14: +4:22 - _56 = &mut _55; // scope 3 at $DIR/loops.rs:+4:14: +4:22 - _57 = as Iterator>::next(_56) -> [return: bb11, unwind: bb19]; // scope 3 at $DIR/loops.rs:+4:14: +4:22 - // mir::Constant - // + span: $DIR/loops.rs:27:14: 27:22 - // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, impl Sized>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } - } - - bb11: { - _58 = discriminant(_57); // scope 3 at $DIR/loops.rs:+4:14: +4:22 - switchInt(move _58) -> [0: bb12, 1: bb14, otherwise: bb18]; // scope 3 at $DIR/loops.rs:+4:14: +4:22 - } - - bb12: { - StorageDead(_57); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - StorageDead(_55); // scope 0 at $DIR/loops.rs:+6:5: +6:6 - drop(_1) -> bb13; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb13: { - return; // scope 0 at $DIR/loops.rs:+7:2: +7:2 - } - - bb14: { - _59 = ((_57 as Some).0: &impl Sized); // scope 3 at $DIR/loops.rs:+4:9: +4:10 - _60 = opaque::<&impl Sized>(_59) -> [return: bb15, unwind: bb19]; // scope 4 at $DIR/loops.rs:+5:9: +5:18 - // mir::Constant - // + span: $DIR/loops.rs:28:9: 28:15 - // + literal: Const { ty: fn(&impl Sized) {opaque::<&impl Sized>}, val: Value() } - } - - bb15: { - StorageDead(_57); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb16: { - _61 = move ((_29 as Some).0: &mut impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 - _62 = opaque::<&mut impl Sized>(move _61) -> [return: bb17, unwind: bb19]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 - // mir::Constant - // + span: $DIR/loops.rs:25:9: 25:15 - // + literal: Const { ty: fn(&mut impl Sized) {opaque::<&mut impl Sized>}, val: Value() } - } - - bb17: { - StorageDead(_29); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb18: { - unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - } - - bb19 (cleanup): { - drop(_1) -> [return: bb20, unwind terminate]; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb20 (cleanup): { - resume; // scope 0 at $DIR/loops.rs:+0:1: +7:2 - } -} diff --git a/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir deleted file mode 100644 index 7cc982bfea0..00000000000 --- a/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir +++ /dev/null @@ -1,604 +0,0 @@ -// MIR for `vec_iter_enumerate` after PreCodegen - -fn vec_iter_enumerate(_1: Vec) -> () { - debug v => _1; // in scope 0 at $DIR/loops.rs:+0:27: +0:32 - let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:51: +0:51 - let mut _2: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 - let mut _14: &mut [impl Sized]; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 - let mut _26: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 - let mut _27: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _28: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _29: &mut std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _30: std::option::Option<(usize, &mut impl Sized)>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _31: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 - let mut _32: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 - let _44: &[impl Sized]; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 - let mut _55: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 - let mut _56: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _57: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _58: &mut std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _59: std::option::Option<(usize, &impl Sized)>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _60: isize; // in scope 0 at $DIR/loops.rs:+4:5: +6:6 - let mut _63: (usize, &impl Sized); // in scope 0 at $DIR/loops.rs:+5:16: +5:22 - let _64: (); // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _67: (usize, &mut impl Sized); // in scope 0 at $DIR/loops.rs:+2:16: +2:22 - let _68: (); // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - scope 1 { - debug iter => _28; // in scope 1 at $DIR/loops.rs:+1:19: +1:43 - let _65: usize; // in scope 1 at $DIR/loops.rs:+1:10: +1:11 - let _66: &mut impl Sized; // in scope 1 at $DIR/loops.rs:+1:13: +1:14 - scope 2 { - debug i => _65; // in scope 2 at $DIR/loops.rs:+1:10: +1:11 - debug x => _66; // in scope 2 at $DIR/loops.rs:+1:13: +1:14 - } - } - scope 3 { - debug iter => _57; // in scope 3 at $DIR/loops.rs:+4:19: +4:39 - let _61: usize; // in scope 3 at $DIR/loops.rs:+4:10: +4:11 - let _62: &impl Sized; // in scope 3 at $DIR/loops.rs:+4:13: +4:14 - scope 4 { - debug i => _61; // in scope 4 at $DIR/loops.rs:+4:10: +4:11 - debug x => _62; // in scope 4 at $DIR/loops.rs:+4:13: +4:14 - } - } - scope 5 (inlined as DerefMut>::deref_mut) { // at $DIR/loops.rs:33:19: 33:31 - debug self => _2; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _7: *mut impl Sized; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _8: usize; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 6 { - scope 7 (inlined Vec::::as_mut_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _3: &alloc::raw_vec::RawVec; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 8 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _3; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _4: std::ptr::Unique; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 9 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _4; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _5: std::ptr::NonNull; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 10 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _5; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _6: *const impl Sized; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 11 (inlined std::slice::from_raw_parts_mut::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _7; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _8; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _13: *mut [impl Sized]; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _69: *mut impl Sized; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _70: usize; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 12 { - scope 13 (inlined std::slice::from_raw_parts_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _69; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _70; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 14 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _70; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 15 { - debug max_len => const _; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 16 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _7; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _8; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _9: *mut (); // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 17 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _7; // in scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - scope 18 (inlined std::ptr::from_raw_parts_mut::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _9; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _8; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _10: *const (); // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _11: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _12: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 19 { - } - } - } - } - } - } - } - scope 20 (inlined core::slice::::iter_mut) { // at $DIR/loops.rs:33:21: 33:31 - debug self => _14; // in scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 21 (inlined std::slice::IterMut::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _14; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _16: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _17: bool; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _18: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _19: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _21: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _22: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _24: std::ptr::NonNull; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _25: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 22 { - debug ptr => _16; // in scope 22 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 23 { - let _20: *mut impl Sized; // in scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 24 { - debug end => _20; // in scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 30 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _16; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _23: *const impl Sized; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _71: *mut impl Sized; // in scope 30 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 31 { - scope 32 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _71; // in scope 32 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 33 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _71; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _72: *mut u8; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 34 { - scope 35 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _72; // in scope 35 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 36 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _72; // in scope 36 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 37 { - scope 38 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _72; // in scope 38 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 26 (inlined invalid_mut::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _22; // in scope 26 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 27 { - } - } - scope 28 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _16; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug count => _19; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 29 { - } - } - } - } - scope 25 (inlined core::slice::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _14; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _15: *mut [impl Sized]; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 39 (inlined as Iterator>::enumerate) { // at $DIR/loops.rs:33:32: 33:43 - debug self => _26; // in scope 39 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - scope 40 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - debug iter => _26; // in scope 40 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - } - } - scope 41 (inlined > as IntoIterator>::into_iter) { // at $DIR/loops.rs:33:19: 33:43 - debug self => _27; // in scope 41 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - scope 42 (inlined as Deref>::deref) { // at $DIR/loops.rs:36:19: 36:27 - debug self => _32; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _38: *const impl Sized; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _39: usize; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 43 { - scope 44 (inlined Vec::::as_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _32; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _33: &alloc::raw_vec::RawVec; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _37: *mut impl Sized; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 45 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _33; // in scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _34: std::ptr::Unique; // in scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 46 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _34; // in scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _35: std::ptr::NonNull; // in scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 47 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _35; // in scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _36: *const impl Sized; // in scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 48 (inlined std::slice::from_raw_parts::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _38; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _39; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let _43: *const [impl Sized]; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _73: *const impl Sized; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _74: usize; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 49 { - scope 50 (inlined std::slice::from_raw_parts::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _73; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _74; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 51 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _74; // in scope 51 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 52 { - debug max_len => const _; // in scope 52 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 53 (inlined slice_from_raw_parts::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _38; // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _39; // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _40: *const (); // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 54 (inlined ptr::const_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _38; // in scope 54 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - } - scope 55 (inlined std::ptr::from_raw_parts::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _40; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _39; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _41: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _42: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 56 { - } - } - } - } - } - } - } - scope 57 (inlined core::slice::::iter) { // at $DIR/loops.rs:36:21: 36:27 - debug self => _44; // in scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 58 (inlined std::slice::Iter::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _44; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _46: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _47: bool; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _48: usize; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _50: usize; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _51: *mut impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _53: std::ptr::NonNull; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _54: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 59 { - debug ptr => _46; // in scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 60 { - let _49: *const impl Sized; // in scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 61 { - debug end => _49; // in scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 67 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _51; // in scope 67 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _52: *const impl Sized; // in scope 67 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _75: *mut impl Sized; // in scope 67 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 68 { - scope 69 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _75; // in scope 69 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 70 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _75; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _76: *mut u8; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 71 { - scope 72 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _76; // in scope 72 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 73 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _76; // in scope 73 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 74 { - scope 75 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _76; // in scope 75 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 63 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _50; // in scope 63 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 64 { - } - } - scope 65 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _46; // in scope 65 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - debug count => _48; // in scope 65 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - scope 66 { - } - } - } - } - scope 62 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _44; // in scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _45: *const [impl Sized]; // in scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 76 (inlined as Iterator>::enumerate) { // at $DIR/loops.rs:36:28: 36:39 - debug self => _55; // in scope 76 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - scope 77 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - debug iter => _55; // in scope 77 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - } - } - scope 78 (inlined > as IntoIterator>::into_iter) { // at $DIR/loops.rs:36:19: 36:39 - debug self => _56; // in scope 78 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - - bb0: { - StorageLive(_26); // scope 0 at $DIR/loops.rs:+1:19: +1:31 - StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:19: +1:31 - _2 = &mut _1; // scope 0 at $DIR/loops.rs:+1:19: +1:31 - StorageLive(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _3 = &((*_2).0: alloc::raw_vec::RawVec); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _4 = ((*_3).0: std::ptr::Unique); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _5 = (_4.0: std::ptr::NonNull); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _6 = (_5.0: *const impl Sized); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _7 = move _6 as *mut impl Sized (PtrToPtr); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageDead(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _8 = ((*_2).1: usize); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_69); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_70); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _9 = _7 as *mut () (PtrToPtr); // scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_12); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _11 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: move _10, metadata: _8 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _12 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _11 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _13 = (_12.1: *mut [impl Sized]); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_12); // scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _14 = &mut (*_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_13); // scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_70); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_69); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:19: +1:20 - StorageLive(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _15 = &raw mut (*_14); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _16 = move _15 as *mut impl Sized (PtrToPtr); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _17 = const _; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _17) -> [0: bb1, otherwise: bb2]; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb1: { - StorageLive(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _18 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _19 = Len((*_18)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = Offset(_16, _19); // scope 29 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb2: { - StorageLive(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _21 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _22 = Len((*_21)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = _22 as *mut impl Sized (Transmute); // scope 27 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb3: { - StorageDead(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_71); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_72); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _23 = _16 as *const impl Sized (Pointer(MutToConstPointer)); // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _24 = NonNull:: { pointer: _23 }; // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_72); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_71); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _25 = _20; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _26 = std::slice::IterMut::<'_, impl Sized> { ptr: move _24, end: move _25, _marker: const ZeroSized: PhantomData<&mut impl Sized> }; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&mut impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _27 = Enumerate::> { iter: move _26, count: const 0_usize }; // scope 40 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - StorageDead(_26); // scope 0 at $DIR/loops.rs:+1:42: +1:43 - StorageLive(_28); // scope 0 at $DIR/loops.rs:+1:19: +1:43 - _28 = move _27; // scope 0 at $DIR/loops.rs:+1:19: +1:43 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb4: { - StorageLive(_30); // scope 1 at $DIR/loops.rs:+1:19: +1:43 - _29 = &mut _28; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - _30 = > as Iterator>::next(_29) -> [return: bb5, unwind: bb19]; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - // mir::Constant - // + span: $DIR/loops.rs:33:19: 33:43 - // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } - } - - bb5: { - _31 = discriminant(_30); // scope 1 at $DIR/loops.rs:+1:19: +1:43 - switchInt(move _31) -> [0: bb6, 1: bb16, otherwise: bb18]; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - } - - bb6: { - StorageDead(_30); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - StorageDead(_28); // scope 0 at $DIR/loops.rs:+3:5: +3:6 - StorageLive(_55); // scope 0 at $DIR/loops.rs:+4:19: +4:27 - StorageLive(_32); // scope 0 at $DIR/loops.rs:+4:19: +4:27 - _32 = &_1; // scope 0 at $DIR/loops.rs:+4:19: +4:27 - StorageLive(_38); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_37); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_33); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _33 = &((*_32).0: alloc::raw_vec::RawVec); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_34); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _34 = ((*_33).0: std::ptr::Unique); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_35); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _35 = (_34.0: std::ptr::NonNull); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_36); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _36 = (_35.0: *const impl Sized); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _37 = move _36 as *mut impl Sized (PtrToPtr); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_36); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_35); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_34); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _38 = move _37 as *const impl Sized (Pointer(MutToConstPointer)); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_33); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_37); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_39); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _39 = ((*_32).1: usize); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_73); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_74); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_43); // scope 49 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_40); // scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _40 = _38 as *const () (PtrToPtr); // scope 54 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageLive(_42); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_41); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _41 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: _40, metadata: _39 }; // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _42 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _41 }; // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_41); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _43 = (_42.0: *const [impl Sized]); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_42); // scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_40); // scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _44 = &(*_43); // scope 49 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_43); // scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_74); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_73); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_39); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_38); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_32); // scope 0 at $DIR/loops.rs:+4:19: +4:20 - StorageLive(_46); // scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_45); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _45 = &raw const (*_44); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _46 = move _45 as *const impl Sized (PtrToPtr); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_45); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_49); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_47); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _47 = const _; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _47) -> [0: bb7, otherwise: bb8]; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb7: { - StorageLive(_48); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _48 = Len((*_44)); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _49 = Offset(_46, _48); // scope 66 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageDead(_48); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb8: { - StorageLive(_50); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _50 = Len((*_44)); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _49 = _50 as *const impl Sized (Transmute); // scope 64 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_50); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb9: { - StorageDead(_47); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_53); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_51); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _51 = _46 as *mut impl Sized (PtrToPtr); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_52); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_75); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_76); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _52 = _51 as *const impl Sized (Pointer(MutToConstPointer)); // scope 68 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _53 = NonNull:: { pointer: _52 }; // scope 68 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_76); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_75); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_52); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_51); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_54); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _54 = _49; // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _55 = std::slice::Iter::<'_, impl Sized> { ptr: move _53, end: move _54, _marker: const ZeroSized: PhantomData<&impl Sized> }; // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_54); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_53); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_49); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_46); // scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _56 = Enumerate::> { iter: move _55, count: const 0_usize }; // scope 77 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - StorageDead(_55); // scope 0 at $DIR/loops.rs:+4:38: +4:39 - StorageLive(_57); // scope 0 at $DIR/loops.rs:+4:19: +4:39 - _57 = move _56; // scope 0 at $DIR/loops.rs:+4:19: +4:39 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb10: { - StorageLive(_59); // scope 3 at $DIR/loops.rs:+4:19: +4:39 - _58 = &mut _57; // scope 3 at $DIR/loops.rs:+4:19: +4:39 - _59 = > as Iterator>::next(_58) -> [return: bb11, unwind: bb19]; // scope 3 at $DIR/loops.rs:+4:19: +4:39 - // mir::Constant - // + span: $DIR/loops.rs:36:19: 36:39 - // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } - } - - bb11: { - _60 = discriminant(_59); // scope 3 at $DIR/loops.rs:+4:19: +4:39 - switchInt(move _60) -> [0: bb12, 1: bb14, otherwise: bb18]; // scope 3 at $DIR/loops.rs:+4:19: +4:39 - } - - bb12: { - StorageDead(_59); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - StorageDead(_57); // scope 0 at $DIR/loops.rs:+6:5: +6:6 - drop(_1) -> bb13; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb13: { - return; // scope 0 at $DIR/loops.rs:+7:2: +7:2 - } - - bb14: { - _61 = (((_59 as Some).0: (usize, &impl Sized)).0: usize); // scope 3 at $DIR/loops.rs:+4:10: +4:11 - _62 = (((_59 as Some).0: (usize, &impl Sized)).1: &impl Sized); // scope 3 at $DIR/loops.rs:+4:13: +4:14 - StorageLive(_63); // scope 4 at $DIR/loops.rs:+5:16: +5:22 - _63 = (_61, _62); // scope 4 at $DIR/loops.rs:+5:16: +5:22 - _64 = opaque::<(usize, &impl Sized)>(move _63) -> [return: bb15, unwind: bb19]; // scope 4 at $DIR/loops.rs:+5:9: +5:23 - // mir::Constant - // + span: $DIR/loops.rs:37:9: 37:15 - // + literal: Const { ty: fn((usize, &impl Sized)) {opaque::<(usize, &impl Sized)>}, val: Value() } - } - - bb15: { - StorageDead(_63); // scope 4 at $DIR/loops.rs:+5:22: +5:23 - StorageDead(_59); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb16: { - _65 = (((_30 as Some).0: (usize, &mut impl Sized)).0: usize); // scope 1 at $DIR/loops.rs:+1:10: +1:11 - _66 = move (((_30 as Some).0: (usize, &mut impl Sized)).1: &mut impl Sized); // scope 1 at $DIR/loops.rs:+1:13: +1:14 - StorageLive(_67); // scope 2 at $DIR/loops.rs:+2:16: +2:22 - _67 = (_65, move _66); // scope 2 at $DIR/loops.rs:+2:16: +2:22 - _68 = opaque::<(usize, &mut impl Sized)>(move _67) -> [return: bb17, unwind: bb19]; // scope 2 at $DIR/loops.rs:+2:9: +2:23 - // mir::Constant - // + span: $DIR/loops.rs:34:9: 34:15 - // + literal: Const { ty: fn((usize, &mut impl Sized)) {opaque::<(usize, &mut impl Sized)>}, val: Value() } - } - - bb17: { - StorageDead(_67); // scope 2 at $DIR/loops.rs:+2:22: +2:23 - StorageDead(_30); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb18: { - unreachable; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - } - - bb19 (cleanup): { - drop(_1) -> [return: bb20, unwind terminate]; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb20 (cleanup): { - resume; // scope 0 at $DIR/loops.rs:+0:1: +7:2 - } -} diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index a73736291e2..db2bf3be7d0 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -21,7 +21,7 @@ fn vec_move(_1: Vec) -> () { StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 _2 = as IntoIterator>::into_iter(move _1) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:15 // mir::Constant - // + span: $DIR/loops.rs:42:14: 42:15 + // + span: $DIR/loops.rs:25:14: 25:15 // + literal: Const { ty: fn(Vec) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } } @@ -36,7 +36,7 @@ fn vec_move(_1: Vec) -> () { _4 = &mut _3; // scope 1 at $DIR/loops.rs:+1:14: +1:15 _5 = as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:15 // mir::Constant - // + span: $DIR/loops.rs:42:14: 42:15 + // + span: $DIR/loops.rs:25:14: 25:15 // + literal: Const { ty: for<'a> fn(&'a mut std::vec::IntoIter) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } @@ -60,7 +60,7 @@ fn vec_move(_1: Vec) -> () { _7 = move ((_5 as Some).0: impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 _8 = opaque::(move _7) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant - // + span: $DIR/loops.rs:43:9: 43:15 + // + span: $DIR/loops.rs:26:9: 26:15 // + literal: Const { ty: fn(impl Sized) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir deleted file mode 100644 index 020d69a2ef3..00000000000 --- a/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir +++ /dev/null @@ -1,204 +0,0 @@ -// MIR for `vec_range` after PreCodegen - -fn vec_range(_1: Vec) -> () { - debug v => _1; // in scope 0 at $DIR/loops.rs:+0:18: +0:23 - let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:42: +0:42 - let mut _2: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:17: +1:24 - let mut _3: usize; // in scope 0 at $DIR/loops.rs:+1:17: +1:24 - let mut _4: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _5: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _7: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _8: isize; // in scope 0 at $DIR/loops.rs:+1:5: +4:6 - let mut _9: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+5:17: +5:24 - let mut _10: usize; // in scope 0 at $DIR/loops.rs:+5:17: +5:24 - let mut _11: std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _12: std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _13: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _14: std::option::Option; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _15: isize; // in scope 0 at $DIR/loops.rs:+5:5: +8:6 - let mut _17: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+6:18: +6:19 - let _18: &impl Sized; // in scope 0 at $DIR/loops.rs:+6:18: +6:22 - let mut _20: (usize, &impl Sized); // in scope 0 at $DIR/loops.rs:+7:16: +7:22 - let _21: (); // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _23: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+2:22: +2:23 - let mut _24: &mut impl Sized; // in scope 0 at $DIR/loops.rs:+2:22: +2:26 - let mut _26: (usize, &mut impl Sized); // in scope 0 at $DIR/loops.rs:+3:16: +3:22 - let _27: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - scope 1 { - debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:24 - let _22: usize; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 - scope 2 { - debug i => _22; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 - let _25: &mut impl Sized; // in scope 2 at $DIR/loops.rs:+2:13: +2:14 - scope 3 { - debug x => _25; // in scope 3 at $DIR/loops.rs:+2:13: +2:14 - } - } - scope 9 (inlined iter::range::>::next) { // at $DIR/loops.rs:13:14: 13:24 - debug self => _6; // in scope 9 at $SRC_DIR/core/src/iter/range.rs:LL:COL - } - } - scope 4 { - debug iter => _12; // in scope 4 at $DIR/loops.rs:+5:14: +5:24 - let _16: usize; // in scope 4 at $DIR/loops.rs:+5:9: +5:10 - scope 5 { - debug i => _16; // in scope 5 at $DIR/loops.rs:+5:9: +5:10 - let _19: &impl Sized; // in scope 5 at $DIR/loops.rs:+6:13: +6:14 - scope 6 { - debug x => _19; // in scope 6 at $DIR/loops.rs:+6:13: +6:14 - } - } - scope 12 (inlined iter::range::>::next) { // at $DIR/loops.rs:17:14: 17:24 - debug self => _13; // in scope 12 at $SRC_DIR/core/src/iter/range.rs:LL:COL - } - } - scope 7 (inlined Vec::::len) { // at $DIR/loops.rs:13:19: 13:24 - debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - } - scope 8 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:13:14: 13:24 - debug self => _4; // in scope 8 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - scope 10 (inlined Vec::::len) { // at $DIR/loops.rs:17:19: 17:24 - debug self => _9; // in scope 10 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - } - scope 11 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:17:14: 17:24 - debug self => _11; // in scope 11 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:17: +1:24 - StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:17: +1:24 - _2 = &_1; // scope 0 at $DIR/loops.rs:+1:17: +1:24 - _3 = ((*_2).1: usize); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:23: +1:24 - _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/loops.rs:+1:14: +1:24 - StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:23: +1:24 - StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:24 - _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:24 - goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +4:6 - } - - bb1: { - StorageLive(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:24 - _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb15]; // scope 9 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: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } - } - - bb2: { - _8 = discriminant(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:24 - switchInt(move _8) -> [0: bb3, 1: bb11, otherwise: bb14]; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - } - - bb3: { - StorageDead(_7); // scope 1 at $DIR/loops.rs:+4:5: +4:6 - StorageDead(_5); // scope 0 at $DIR/loops.rs:+4:5: +4:6 - StorageLive(_10); // scope 0 at $DIR/loops.rs:+5:17: +5:24 - StorageLive(_9); // scope 0 at $DIR/loops.rs:+5:17: +5:24 - _9 = &_1; // scope 0 at $DIR/loops.rs:+5:17: +5:24 - _10 = ((*_9).1: usize); // scope 10 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_9); // scope 0 at $DIR/loops.rs:+5:23: +5:24 - _11 = std::ops::Range:: { start: const 0_usize, end: move _10 }; // scope 0 at $DIR/loops.rs:+5:14: +5:24 - StorageDead(_10); // scope 0 at $DIR/loops.rs:+5:23: +5:24 - StorageLive(_12); // scope 0 at $DIR/loops.rs:+5:14: +5:24 - _12 = move _11; // scope 0 at $DIR/loops.rs:+5:14: +5:24 - goto -> bb4; // scope 4 at $DIR/loops.rs:+5:5: +8:6 - } - - bb4: { - StorageLive(_14); // scope 4 at $DIR/loops.rs:+5:14: +5:24 - _13 = &mut _12; // scope 4 at $DIR/loops.rs:+5:14: +5:24 - _14 = as iter::range::RangeIteratorImpl>::spec_next(_13) -> [return: bb5, unwind: bb15]; // scope 12 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: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } - } - - bb5: { - _15 = discriminant(_14); // scope 4 at $DIR/loops.rs:+5:14: +5:24 - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb14]; // scope 4 at $DIR/loops.rs:+5:14: +5:24 - } - - bb6: { - StorageDead(_14); // scope 4 at $DIR/loops.rs:+8:5: +8:6 - StorageDead(_12); // scope 0 at $DIR/loops.rs:+8:5: +8:6 - drop(_1) -> bb7; // scope 0 at $DIR/loops.rs:+9:1: +9:2 - } - - bb7: { - return; // scope 0 at $DIR/loops.rs:+9:2: +9:2 - } - - bb8: { - _16 = ((_14 as Some).0: usize); // scope 4 at $DIR/loops.rs:+5:9: +5:10 - StorageLive(_18); // scope 5 at $DIR/loops.rs:+6:18: +6:22 - StorageLive(_17); // scope 5 at $DIR/loops.rs:+6:18: +6:19 - _17 = &_1; // scope 5 at $DIR/loops.rs:+6:18: +6:19 - _18 = as Index>::index(move _17, _16) -> [return: bb9, unwind: bb15]; // scope 5 at $DIR/loops.rs:+6:18: +6:22 - // mir::Constant - // + span: $DIR/loops.rs:18:18: 18:22 - // + literal: Const { ty: for<'a> fn(&'a Vec, usize) -> &'a as Index>::Output { as Index>::index}, val: Value() } - } - - bb9: { - StorageDead(_17); // scope 5 at $DIR/loops.rs:+6:21: +6:22 - _19 = _18; // scope 5 at $DIR/loops.rs:+6:17: +6:22 - StorageLive(_20); // scope 6 at $DIR/loops.rs:+7:16: +7:22 - _20 = (_16, _19); // scope 6 at $DIR/loops.rs:+7:16: +7:22 - _21 = opaque::<(usize, &impl Sized)>(move _20) -> [return: bb10, unwind: bb15]; // scope 6 at $DIR/loops.rs:+7:9: +7:23 - // mir::Constant - // + span: $DIR/loops.rs:19:9: 19:15 - // + literal: Const { ty: fn((usize, &impl Sized)) {opaque::<(usize, &impl Sized)>}, val: Value() } - } - - bb10: { - StorageDead(_20); // scope 6 at $DIR/loops.rs:+7:22: +7:23 - StorageDead(_18); // scope 5 at $DIR/loops.rs:+8:5: +8:6 - StorageDead(_14); // scope 4 at $DIR/loops.rs:+8:5: +8:6 - goto -> bb4; // scope 4 at $DIR/loops.rs:+5:5: +8:6 - } - - bb11: { - _22 = ((_7 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 - StorageLive(_24); // scope 2 at $DIR/loops.rs:+2:22: +2:26 - StorageLive(_23); // scope 2 at $DIR/loops.rs:+2:22: +2:23 - _23 = &mut _1; // scope 2 at $DIR/loops.rs:+2:22: +2:23 - _24 = as IndexMut>::index_mut(move _23, _22) -> [return: bb12, unwind: bb15]; // scope 2 at $DIR/loops.rs:+2:22: +2:26 - // mir::Constant - // + span: $DIR/loops.rs:14:22: 14:26 - // + literal: Const { ty: for<'a> fn(&'a mut Vec, usize) -> &'a mut as Index>::Output { as IndexMut>::index_mut}, val: Value() } - } - - bb12: { - StorageDead(_23); // scope 2 at $DIR/loops.rs:+2:25: +2:26 - _25 = _24; // scope 2 at $DIR/loops.rs:+2:17: +2:26 - StorageLive(_26); // scope 3 at $DIR/loops.rs:+3:16: +3:22 - _26 = (_22, move _25); // scope 3 at $DIR/loops.rs:+3:16: +3:22 - _27 = opaque::<(usize, &mut impl Sized)>(move _26) -> [return: bb13, unwind: bb15]; // scope 3 at $DIR/loops.rs:+3:9: +3:23 - // mir::Constant - // + span: $DIR/loops.rs:15:9: 15:15 - // + literal: Const { ty: fn((usize, &mut impl Sized)) {opaque::<(usize, &mut impl Sized)>}, val: Value() } - } - - bb13: { - StorageDead(_26); // scope 3 at $DIR/loops.rs:+3:22: +3:23 - StorageDead(_24); // scope 2 at $DIR/loops.rs:+4:5: +4:6 - StorageDead(_7); // scope 1 at $DIR/loops.rs:+4:5: +4:6 - goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +4:6 - } - - bb14: { - unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - } - - bb15 (cleanup): { - drop(_1) -> [return: bb16, unwind terminate]; // scope 0 at $DIR/loops.rs:+9:1: +9:2 - } - - bb16 (cleanup): { - resume; // scope 0 at $DIR/loops.rs:+0:1: +9:2 - } -} diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir new file mode 100644 index 00000000000..25a3421793d --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir @@ -0,0 +1,216 @@ +// MIR for `enumerated_loop` after PreCodegen + +fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:36 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:47: +0:48 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:70: +0:70 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:31 + let mut _14: std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _15: std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _16: &mut std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _17: std::option::Option<(usize, &T)>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _18: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _21: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _22: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:16 + let _23: (); // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + scope 1 { + debug iter => _15; // in scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + let _19: usize; // in scope 1 at $DIR/slice_iter.rs:+1:10: +1:11 + let _20: &T; // in scope 1 at $DIR/slice_iter.rs:+1:13: +1:14 + scope 2 { + debug i => _19; // in scope 2 at $DIR/slice_iter.rs:+1:10: +1:11 + debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:13: +1:14 + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:42:25: 42:31 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _24: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _24; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _24; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _25: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _25; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _25; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _25; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as Iterator>::enumerate) { // at $DIR/slice_iter.rs:42:32: 42:43 + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 23 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + } + } + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:42:19: 42:43 + debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_13); // scope 0 at $DIR/slice_iter.rs:+1:19: +1:31 + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _14 = Enumerate::> { iter: move _13, count: const 0_usize }; // scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + StorageDead(_13); // scope 0 at $DIR/slice_iter.rs:+1:42: +1:43 + StorageLive(_15); // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + _15 = move _14; // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_17); // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + _16 = &mut _15; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + _17 = > as Iterator>::next(_16) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + // mir::Constant + // + span: $DIR/slice_iter.rs:42:19: 42:43 + // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } + } + + bb5: { + _18 = discriminant(_17); // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + } + + bb6: { + StorageDead(_17); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_15); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8: { + _19 = (((_17 as Some).0: (usize, &T)).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:10: +1:11 + _20 = (((_17 as Some).0: (usize, &T)).1: &T); // scope 1 at $DIR/slice_iter.rs:+1:13: +1:14 + StorageLive(_21); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _21 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_22); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + _22 = (_19, _20); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + // mir::Constant + // + span: $DIR/slice_iter.rs:43:9: 43:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_22); // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16 + StorageDead(_21); // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16 + StorageDead(_17); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + } + + bb11 (cleanup): { + drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb12 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir new file mode 100644 index 00000000000..a81bd998d89 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir @@ -0,0 +1,107 @@ +// 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 _7: std::option::Option; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6 + let mut _10: usize; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _11: bool; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _13: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10 + let mut _14: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16 + let _15: (); // 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 _9: usize; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug i => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + let _12: &T; // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14 + scope 3 { + debug x => _12; // 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 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(_7); // 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 + _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb9]; // scope 5 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: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _8 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } + + bb3: { + StorageDead(_7); // 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) -> bb4; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + } + + bb4: { + return; // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2 + } + + bb5: { + _9 = ((_7 as Some).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + _10 = Len((*_1)); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + _11 = Lt(_9, _10); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, _9) -> [success: bb6, unwind: bb9]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + } + + bb6: { + _12 = &(*_1)[_9]; // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26 + StorageLive(_13); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + _13 = &_2; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + StorageLive(_14); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _14 = (_9, _12); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _15 = >::call(move _13, move _14) -> [return: bb7, unwind: bb9]; // 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() } + } + + bb7: { + StorageDead(_14); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_13); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } + + bb9 (cleanup): { + drop(_2) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +5:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs index ca423ca55e6..a1cd85e753f 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.rs +++ b/tests/mir-opt/pre-codegen/slice_iter.rs @@ -36,3 +36,18 @@ pub fn reverse_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) { f(x) } } + +// EMIT_MIR slice_iter.enumerated_loop.PreCodegen.after.mir +pub fn enumerated_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) { + for (i, x) in slice.iter().enumerate() { + f(i, x) + } +} + +// EMIT_MIR slice_iter.range_loop.PreCodegen.after.mir +pub fn range_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) { + for i in 0..slice.len() { + let x = &slice[i]; + f(i, x) + } +}