From a5031d569e69bc8e6ff7d10b22bbab1e946b62b0 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 1 Jul 2023 09:01:33 +0000 Subject: [PATCH] Call super for debuginfo. --- compiler/rustc_mir_transform/src/ref_prop.rs | 19 ++- .../loops.int_range.PreCodegen.after.mir | 87 ++++++------- ...ward_loop.PreCodegen.after.panic-abort.mir | 103 +++++++-------- ...ard_loop.PreCodegen.after.panic-unwind.mir | 103 +++++++-------- ...ange_loop.PreCodegen.after.panic-abort.mir | 122 ++++++++---------- ...nge_loop.PreCodegen.after.panic-unwind.mir | 122 ++++++++---------- 6 files changed, 266 insertions(+), 290 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index d296788d268..c17c791f9c3 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -355,7 +355,10 @@ fn tcx(&self) -> TyCtxt<'tcx> { } fn visit_var_debug_info(&mut self, debuginfo: &mut VarDebugInfo<'tcx>) { - if let VarDebugInfoContents::Place(ref mut place) = debuginfo.value + // If the debuginfo is a pointer to another place: + // - if it's a reborrow, see through it; + // - if it's a direct borrow, increase `debuginfo.references`. + while let VarDebugInfoContents::Place(ref mut place) = debuginfo.value && place.projection.is_empty() && let Value::Pointer(target, _) = self.targets[place.local] && target.projection.iter().all(|p| p.can_use_in_debuginfo()) @@ -369,8 +372,13 @@ fn visit_var_debug_info(&mut self, debuginfo: &mut VarDebugInfo<'tcx>) { debuginfo.references = references; *place = target; self.any_replacement = true; + } else { + break } } + + // Simplify eventual projections left inside `debuginfo`. + self.super_var_debug_info(debuginfo); } fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) { @@ -381,8 +389,13 @@ fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Loca let Value::Pointer(target, _) = self.targets[place.local] else { return }; - let perform_opt = matches!(ctxt, PlaceContext::NonUse(_)) - || self.allowed_replacements.contains(&(target.local, loc)); + let perform_opt = match ctxt { + PlaceContext::NonUse(NonUseContext::VarDebugInfo) => { + target.projection.iter().all(|p| p.can_use_in_debuginfo()) + } + PlaceContext::NonUse(_) => true, + _ => self.allowed_replacements.contains(&(target.local, loc)), + }; if !perform_opt { return; diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index b696585b233..99dc9600e41 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -4,102 +4,95 @@ fn int_range(_1: usize, _2: usize) -> () { debug start => _1; debug end => _2; let mut _0: (); - let mut _3: std::ops::Range; - let mut _4: std::ops::Range; - let mut _8: std::option::Option; - let mut _11: isize; - let _13: (); - let mut _14: &mut std::ops::Range; + let mut _3: usize; + let mut _6: std::option::Option; + let mut _9: isize; + let _11: (); scope 1 { - debug iter => _4; - let _12: usize; + debug iter => std::ops::Range{ .0 => _3, .1 => _2, }; + let _10: usize; scope 2 { - debug i => _12; + debug i => _10; } scope 4 (inlined iter::range::>::next) { - debug self => &_4; + debug self => &std::ops::Range{ .0 => _3, .1 => _2, }; scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => &_4; - let mut _7: bool; - let _9: usize; - let mut _10: usize; + debug self => &std::ops::Range{ .0 => _3, .1 => _2, }; + let mut _5: bool; + let _7: usize; + let mut _8: usize; scope 6 { - debug old => _9; + debug old => _7; scope 7 { } } scope 8 (inlined cmp::impls::::lt) { - debug self => &((*_14).0: usize); - debug other => &((*_14).1: usize); - let mut _5: usize; - let mut _6: usize; + debug self => &_3; + debug other => &_2; + let mut _4: usize; } } } } scope 3 (inlined as IntoIterator>::into_iter) { - debug self => _3; + debug self => std::ops::Range{ .0 => _1, .1 => _2, }; } bb0: { - _3 = std::ops::Range:: { start: _1, end: _2 }; - StorageLive(_4); - _4 = move _3; + StorageLive(_3); + _3 = _1; goto -> bb1; } bb1: { - StorageLive(_8); - StorageLive(_9); + StorageLive(_6); StorageLive(_7); StorageLive(_5); - _5 = (_4.0: usize); - StorageLive(_6); - _6 = (_4.1: usize); - _7 = Lt(move _5, move _6); - StorageDead(_6); - StorageDead(_5); - switchInt(move _7) -> [0: bb2, otherwise: bb3]; + StorageLive(_4); + _4 = _3; + _5 = Lt(move _4, _2); + StorageDead(_4); + switchInt(move _5) -> [0: bb2, otherwise: bb3]; } bb2: { - _8 = Option::::None; + _6 = Option::::None; goto -> bb5; } bb3: { - _9 = (_4.0: usize); - StorageLive(_10); - _10 = ::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue]; + _7 = _3; + StorageLive(_8); + _8 = ::forward_unchecked(_7, const 1_usize) -> [return: bb4, unwind continue]; } bb4: { - (_4.0: usize) = move _10; - StorageDead(_10); - _8 = Option::::Some(_9); + _3 = move _8; + StorageDead(_8); + _6 = Option::::Some(_7); goto -> bb5; } bb5: { + StorageDead(_5); StorageDead(_7); - StorageDead(_9); - _11 = discriminant(_8); - switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9]; + _9 = discriminant(_6); + switchInt(move _9) -> [0: bb6, 1: bb7, otherwise: bb9]; } bb6: { - StorageDead(_8); - StorageDead(_4); + StorageDead(_6); + StorageDead(_3); return; } bb7: { - _12 = ((_8 as Some).0: usize); - _13 = opaque::(_12) -> [return: bb8, unwind continue]; + _10 = ((_6 as Some).0: usize); + _11 = opaque::(_10) -> [return: bb8, unwind continue]; } bb8: { - StorageDead(_8); + StorageDead(_6); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir index 4c109544d22..cdaa3cfc995 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -5,94 +5,87 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { debug end => _2; debug f => _3; let mut _0: (); - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _9: std::option::Option; - let mut _12: isize; - let mut _14: &impl Fn(u32); - let mut _15: (u32,); - let _16: (); - let mut _17: &mut std::ops::Range; + let mut _4: u32; + let mut _7: std::option::Option; + let mut _10: isize; + let mut _12: &impl Fn(u32); + let mut _13: (u32,); + let _14: (); scope 1 { - debug iter => _5; - let _13: u32; + debug iter => std::ops::Range{ .0 => _4, .1 => _2, }; + let _11: u32; scope 2 { - debug x => _13; + debug x => _11; } scope 4 (inlined iter::range::>::next) { - debug self => &_5; + debug self => &std::ops::Range{ .0 => _4, .1 => _2, }; scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => &_5; - let mut _8: bool; - let _10: u32; - let mut _11: u32; + debug self => &std::ops::Range{ .0 => _4, .1 => _2, }; + let mut _6: bool; + let _8: u32; + let mut _9: u32; scope 6 { - debug old => _10; + debug old => _8; scope 7 { } } scope 8 (inlined cmp::impls::::lt) { - debug self => &((*_17).0: u32); - debug other => &((*_17).1: u32); - let mut _6: u32; - let mut _7: u32; + debug self => &_4; + debug other => &_2; + let mut _5: u32; } } } } scope 3 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range{ .0 => _1, .1 => _2, }; } bb0: { - _4 = std::ops::Range:: { start: _1, end: _2 }; - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = _1; goto -> bb1; } bb1: { - StorageLive(_9); - StorageLive(_10); + StorageLive(_7); StorageLive(_8); StorageLive(_6); - _6 = (_5.0: u32); - StorageLive(_7); - _7 = (_5.1: u32); - _8 = Lt(move _6, move _7); - StorageDead(_7); - StorageDead(_6); - switchInt(move _8) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _2); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _9 = Option::::None; + _7 = Option::::None; goto -> bb5; } bb3: { - _10 = (_5.0: u32); - StorageLive(_11); - _11 = ::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; + _8 = _4; + StorageLive(_9); + _9 = ::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { - (_5.0: u32) = move _11; - StorageDead(_11); - _9 = Option::::Some(_10); + _4 = move _9; + StorageDead(_9); + _7 = Option::::Some(_8); goto -> bb5; } bb5: { + StorageDead(_6); StorageDead(_8); - StorageDead(_10); - _12 = discriminant(_9); - switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10]; + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_9); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_3) -> [return: bb7, unwind unreachable]; } @@ -101,18 +94,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb8: { - _13 = ((_9 as Some).0: u32); - StorageLive(_14); - _14 = &_3; - StorageLive(_15); - _15 = (_13,); - _16 = >::call(move _14, move _15) -> [return: bb9, unwind unreachable]; + _11 = ((_7 as Some).0: u32); + StorageLive(_12); + _12 = &_3; + StorageLive(_13); + _13 = (_11,); + _14 = >::call(move _12, move _13) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_15); - StorageDead(_14); - StorageDead(_9); + StorageDead(_13); + StorageDead(_12); + StorageDead(_7); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index d81c8487812..c4e56ea3b23 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -5,94 +5,87 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { debug end => _2; debug f => _3; let mut _0: (); - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _9: std::option::Option; - let mut _12: isize; - let mut _14: &impl Fn(u32); - let mut _15: (u32,); - let _16: (); - let mut _17: &mut std::ops::Range; + let mut _4: u32; + let mut _7: std::option::Option; + let mut _10: isize; + let mut _12: &impl Fn(u32); + let mut _13: (u32,); + let _14: (); scope 1 { - debug iter => _5; - let _13: u32; + debug iter => std::ops::Range{ .0 => _4, .1 => _2, }; + let _11: u32; scope 2 { - debug x => _13; + debug x => _11; } scope 4 (inlined iter::range::>::next) { - debug self => &_5; + debug self => &std::ops::Range{ .0 => _4, .1 => _2, }; scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => &_5; - let mut _8: bool; - let _10: u32; - let mut _11: u32; + debug self => &std::ops::Range{ .0 => _4, .1 => _2, }; + let mut _6: bool; + let _8: u32; + let mut _9: u32; scope 6 { - debug old => _10; + debug old => _8; scope 7 { } } scope 8 (inlined cmp::impls::::lt) { - debug self => &((*_17).0: u32); - debug other => &((*_17).1: u32); - let mut _6: u32; - let mut _7: u32; + debug self => &_4; + debug other => &_2; + let mut _5: u32; } } } } scope 3 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range{ .0 => _1, .1 => _2, }; } bb0: { - _4 = std::ops::Range:: { start: _1, end: _2 }; - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = _1; goto -> bb1; } bb1: { - StorageLive(_9); - StorageLive(_10); + StorageLive(_7); StorageLive(_8); StorageLive(_6); - _6 = (_5.0: u32); - StorageLive(_7); - _7 = (_5.1: u32); - _8 = Lt(move _6, move _7); - StorageDead(_7); - StorageDead(_6); - switchInt(move _8) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _2); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _9 = Option::::None; + _7 = Option::::None; goto -> bb5; } bb3: { - _10 = (_5.0: u32); - StorageLive(_11); - _11 = ::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11]; + _8 = _4; + StorageLive(_9); + _9 = ::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind: bb11]; } bb4: { - (_5.0: u32) = move _11; - StorageDead(_11); - _9 = Option::::Some(_10); + _4 = move _9; + StorageDead(_9); + _7 = Option::::Some(_8); goto -> bb5; } bb5: { + StorageDead(_6); StorageDead(_8); - StorageDead(_10); - _12 = discriminant(_9); - switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10]; + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_9); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_3) -> [return: bb7, unwind continue]; } @@ -101,18 +94,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb8: { - _13 = ((_9 as Some).0: u32); - StorageLive(_14); - _14 = &_3; - StorageLive(_15); - _15 = (_13,); - _16 = >::call(move _14, move _15) -> [return: bb9, unwind: bb11]; + _11 = ((_7 as Some).0: u32); + StorageLive(_12); + _12 = &_3; + StorageLive(_13); + _13 = (_11,); + _14 = >::call(move _12, move _13) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_15); - StorageDead(_14); - StorageDead(_9); + StorageDead(_13); + StorageDead(_12); + StorageDead(_7); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir index 8ae6452d133..901381f070b 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -5,103 +5,95 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug f => _2; let mut _0: (); let mut _3: usize; - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _9: std::option::Option; - let mut _12: isize; - let mut _14: usize; - let mut _15: bool; - let mut _17: &impl Fn(usize, &T); - let mut _18: (usize, &T); - let _19: (); - let mut _20: &mut std::ops::Range; + let mut _4: usize; + let mut _7: std::option::Option; + let mut _10: isize; + let mut _12: usize; + let mut _13: bool; + let mut _15: &impl Fn(usize, &T); + let mut _16: (usize, &T); + let _17: (); + let mut _18: usize; scope 1 { - debug iter => _5; - let _13: usize; + debug iter => std::ops::Range{ .0 => _4, .1 => _3, }; + let _11: usize; scope 2 { - debug i => _13; - let _16: &T; + debug i => _11; + let _14: &T; scope 3 { - debug x => _16; + debug x => _14; } } scope 5 (inlined iter::range::>::next) { - debug self => &_5; + debug self => &std::ops::Range{ .0 => _4, .1 => _3, }; scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => &_5; - let mut _8: bool; - let _10: usize; - let mut _11: usize; + debug self => &std::ops::Range{ .0 => _4, .1 => _3, }; + let mut _6: bool; + let _8: usize; + let mut _9: usize; scope 7 { - debug old => _10; + debug old => _8; scope 8 { } } scope 9 (inlined cmp::impls::::lt) { - debug self => &((*_20).0: usize); - debug other => &((*_20).1: usize); - let mut _6: usize; - let mut _7: usize; + debug self => &_4; + debug other => &_3; + let mut _5: usize; } } } } scope 4 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range{ .0 => _18, .1 => _3, }; } bb0: { - StorageLive(_3); _3 = Len((*_1)); - _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; - StorageDead(_3); - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = const 0_usize; goto -> bb1; } bb1: { - StorageLive(_9); - StorageLive(_10); + StorageLive(_7); StorageLive(_8); StorageLive(_6); - _6 = (_5.0: usize); - StorageLive(_7); - _7 = (_5.1: usize); - _8 = Lt(move _6, move _7); - StorageDead(_7); - StorageDead(_6); - switchInt(move _8) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _3); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _9 = Option::::None; + _7 = Option::::None; goto -> bb5; } bb3: { - _10 = (_5.0: usize); - StorageLive(_11); - _11 = ::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; + _8 = _4; + StorageLive(_9); + _9 = ::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { - (_5.0: usize) = move _11; - StorageDead(_11); - _9 = Option::::Some(_10); + _4 = move _9; + StorageDead(_9); + _7 = Option::::Some(_8); goto -> bb5; } bb5: { + StorageDead(_6); StorageDead(_8); - StorageDead(_10); - _12 = discriminant(_9); - switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11]; + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { - StorageDead(_9); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -110,25 +102,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _13 = ((_9 as Some).0: usize); - _14 = Len((*_1)); - _15 = Lt(_13, _14); - assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable]; + _11 = ((_7 as Some).0: usize); + _12 = Len((*_1)); + _13 = Lt(_11, _12); + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb9, unwind unreachable]; } bb9: { - _16 = &(*_1)[_13]; - StorageLive(_17); - _17 = &_2; - StorageLive(_18); - _18 = (_13, _16); - _19 = >::call(move _17, move _18) -> [return: bb10, unwind unreachable]; + _14 = &(*_1)[_11]; + StorageLive(_15); + _15 = &_2; + StorageLive(_16); + _16 = (_11, _14); + _17 = >::call(move _15, move _16) -> [return: bb10, unwind unreachable]; } bb10: { - StorageDead(_18); - StorageDead(_17); - StorageDead(_9); + StorageDead(_16); + StorageDead(_15); + StorageDead(_7); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index cb07a2be169..a47a73395cf 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -5,103 +5,95 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug f => _2; let mut _0: (); let mut _3: usize; - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _9: std::option::Option; - let mut _12: isize; - let mut _14: usize; - let mut _15: bool; - let mut _17: &impl Fn(usize, &T); - let mut _18: (usize, &T); - let _19: (); - let mut _20: &mut std::ops::Range; + let mut _4: usize; + let mut _7: std::option::Option; + let mut _10: isize; + let mut _12: usize; + let mut _13: bool; + let mut _15: &impl Fn(usize, &T); + let mut _16: (usize, &T); + let _17: (); + let mut _18: usize; scope 1 { - debug iter => _5; - let _13: usize; + debug iter => std::ops::Range{ .0 => _4, .1 => _3, }; + let _11: usize; scope 2 { - debug i => _13; - let _16: &T; + debug i => _11; + let _14: &T; scope 3 { - debug x => _16; + debug x => _14; } } scope 5 (inlined iter::range::>::next) { - debug self => &_5; + debug self => &std::ops::Range{ .0 => _4, .1 => _3, }; scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => &_5; - let mut _8: bool; - let _10: usize; - let mut _11: usize; + debug self => &std::ops::Range{ .0 => _4, .1 => _3, }; + let mut _6: bool; + let _8: usize; + let mut _9: usize; scope 7 { - debug old => _10; + debug old => _8; scope 8 { } } scope 9 (inlined cmp::impls::::lt) { - debug self => &((*_20).0: usize); - debug other => &((*_20).1: usize); - let mut _6: usize; - let mut _7: usize; + debug self => &_4; + debug other => &_3; + let mut _5: usize; } } } } scope 4 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range{ .0 => _18, .1 => _3, }; } bb0: { - StorageLive(_3); _3 = Len((*_1)); - _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; - StorageDead(_3); - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = const 0_usize; goto -> bb1; } bb1: { - StorageLive(_9); - StorageLive(_10); + StorageLive(_7); StorageLive(_8); StorageLive(_6); - _6 = (_5.0: usize); - StorageLive(_7); - _7 = (_5.1: usize); - _8 = Lt(move _6, move _7); - StorageDead(_7); - StorageDead(_6); - switchInt(move _8) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _3); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _9 = Option::::None; + _7 = Option::::None; goto -> bb5; } bb3: { - _10 = (_5.0: usize); - StorageLive(_11); - _11 = ::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12]; + _8 = _4; + StorageLive(_9); + _9 = ::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind: bb12]; } bb4: { - (_5.0: usize) = move _11; - StorageDead(_11); - _9 = Option::::Some(_10); + _4 = move _9; + StorageDead(_9); + _7 = Option::::Some(_8); goto -> bb5; } bb5: { + StorageDead(_6); StorageDead(_8); - StorageDead(_10); - _12 = discriminant(_9); - switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11]; + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { - StorageDead(_9); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_2) -> [return: bb7, unwind continue]; } @@ -110,25 +102,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _13 = ((_9 as Some).0: usize); - _14 = Len((*_1)); - _15 = Lt(_13, _14); - assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind: bb12]; + _11 = ((_7 as Some).0: usize); + _12 = Len((*_1)); + _13 = Lt(_11, _12); + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb9, unwind: bb12]; } bb9: { - _16 = &(*_1)[_13]; - StorageLive(_17); - _17 = &_2; - StorageLive(_18); - _18 = (_13, _16); - _19 = >::call(move _17, move _18) -> [return: bb10, unwind: bb12]; + _14 = &(*_1)[_11]; + StorageLive(_15); + _15 = &_2; + StorageLive(_16); + _16 = (_11, _14); + _17 = >::call(move _15, move _16) -> [return: bb10, unwind: bb12]; } bb10: { - StorageDead(_18); - StorageDead(_17); - StorageDead(_9); + StorageDead(_16); + StorageDead(_15); + StorageDead(_7); goto -> bb1; }