1
Fork 0

Call super for debuginfo.

This commit is contained in:
Camille GILLOT 2023-07-01 09:01:33 +00:00
parent b4c342edea
commit a5031d569e
6 changed files with 266 additions and 290 deletions

View file

@ -355,7 +355,10 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
} }
fn visit_var_debug_info(&mut self, debuginfo: &mut VarDebugInfo<'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() && place.projection.is_empty()
&& let Value::Pointer(target, _) = self.targets[place.local] && let Value::Pointer(target, _) = self.targets[place.local]
&& target.projection.iter().all(|p| p.can_use_in_debuginfo()) && target.projection.iter().all(|p| p.can_use_in_debuginfo())
@ -369,8 +372,13 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
debuginfo.references = references; debuginfo.references = references;
*place = target; *place = target;
self.any_replacement = true; 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) { fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) {
@ -381,8 +389,13 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
let Value::Pointer(target, _) = self.targets[place.local] else { return }; let Value::Pointer(target, _) = self.targets[place.local] else { return };
let perform_opt = matches!(ctxt, PlaceContext::NonUse(_)) let perform_opt = match ctxt {
|| self.allowed_replacements.contains(&(target.local, loc)); 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 { if !perform_opt {
return; return;

View file

@ -4,102 +4,95 @@ fn int_range(_1: usize, _2: usize) -> () {
debug start => _1; debug start => _1;
debug end => _2; debug end => _2;
let mut _0: (); let mut _0: ();
let mut _3: std::ops::Range<usize>; let mut _3: usize;
let mut _4: std::ops::Range<usize>; let mut _6: std::option::Option<usize>;
let mut _8: std::option::Option<usize>; let mut _9: isize;
let mut _11: isize; let _11: ();
let _13: ();
let mut _14: &mut std::ops::Range<usize>;
scope 1 { scope 1 {
debug iter => _4; debug iter => std::ops::Range<usize>{ .0 => _3, .1 => _2, };
let _12: usize; let _10: usize;
scope 2 { scope 2 {
debug i => _12; debug i => _10;
} }
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
debug self => &_4; debug self => &std::ops::Range<usize>{ .0 => _3, .1 => _2, };
scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => &_4; debug self => &std::ops::Range<usize>{ .0 => _3, .1 => _2, };
let mut _7: bool; let mut _5: bool;
let _9: usize; let _7: usize;
let mut _10: usize; let mut _8: usize;
scope 6 { scope 6 {
debug old => _9; debug old => _7;
scope 7 { scope 7 {
} }
} }
scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
debug self => &((*_14).0: usize); debug self => &_3;
debug other => &((*_14).1: usize); debug other => &_2;
let mut _5: usize; let mut _4: usize;
let mut _6: usize;
} }
} }
} }
} }
scope 3 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { scope 3 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
debug self => _3; debug self => std::ops::Range<usize>{ .0 => _1, .1 => _2, };
} }
bb0: { bb0: {
_3 = std::ops::Range::<usize> { start: _1, end: _2 }; StorageLive(_3);
StorageLive(_4); _3 = _1;
_4 = move _3;
goto -> bb1; goto -> bb1;
} }
bb1: { bb1: {
StorageLive(_8); StorageLive(_6);
StorageLive(_9);
StorageLive(_7); StorageLive(_7);
StorageLive(_5); StorageLive(_5);
_5 = (_4.0: usize); StorageLive(_4);
StorageLive(_6); _4 = _3;
_6 = (_4.1: usize); _5 = Lt(move _4, _2);
_7 = Lt(move _5, move _6); StorageDead(_4);
StorageDead(_6); switchInt(move _5) -> [0: bb2, otherwise: bb3];
StorageDead(_5);
switchInt(move _7) -> [0: bb2, otherwise: bb3];
} }
bb2: { bb2: {
_8 = Option::<usize>::None; _6 = Option::<usize>::None;
goto -> bb5; goto -> bb5;
} }
bb3: { bb3: {
_9 = (_4.0: usize); _7 = _3;
StorageLive(_10); StorageLive(_8);
_10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue]; _8 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb4, unwind continue];
} }
bb4: { bb4: {
(_4.0: usize) = move _10; _3 = move _8;
StorageDead(_10); StorageDead(_8);
_8 = Option::<usize>::Some(_9); _6 = Option::<usize>::Some(_7);
goto -> bb5; goto -> bb5;
} }
bb5: { bb5: {
StorageDead(_5);
StorageDead(_7); StorageDead(_7);
StorageDead(_9); _9 = discriminant(_6);
_11 = discriminant(_8); switchInt(move _9) -> [0: bb6, 1: bb7, otherwise: bb9];
switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9];
} }
bb6: { bb6: {
StorageDead(_8); StorageDead(_6);
StorageDead(_4); StorageDead(_3);
return; return;
} }
bb7: { bb7: {
_12 = ((_8 as Some).0: usize); _10 = ((_6 as Some).0: usize);
_13 = opaque::<usize>(_12) -> [return: bb8, unwind continue]; _11 = opaque::<usize>(_10) -> [return: bb8, unwind continue];
} }
bb8: { bb8: {
StorageDead(_8); StorageDead(_6);
goto -> bb1; goto -> bb1;
} }

View file

@ -5,94 +5,87 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
debug end => _2; debug end => _2;
debug f => _3; debug f => _3;
let mut _0: (); let mut _0: ();
let mut _4: std::ops::Range<u32>; let mut _4: u32;
let mut _5: std::ops::Range<u32>; let mut _7: std::option::Option<u32>;
let mut _9: std::option::Option<u32>; let mut _10: isize;
let mut _12: isize; let mut _12: &impl Fn(u32);
let mut _14: &impl Fn(u32); let mut _13: (u32,);
let mut _15: (u32,); let _14: ();
let _16: ();
let mut _17: &mut std::ops::Range<u32>;
scope 1 { scope 1 {
debug iter => _5; debug iter => std::ops::Range<u32>{ .0 => _4, .1 => _2, };
let _13: u32; let _11: u32;
scope 2 { scope 2 {
debug x => _13; debug x => _11;
} }
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
debug self => &_5; debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, };
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => &_5; debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, };
let mut _8: bool; let mut _6: bool;
let _10: u32; let _8: u32;
let mut _11: u32; let mut _9: u32;
scope 6 { scope 6 {
debug old => _10; debug old => _8;
scope 7 { scope 7 {
} }
} }
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
debug self => &((*_17).0: u32); debug self => &_4;
debug other => &((*_17).1: u32); debug other => &_2;
let mut _6: u32; let mut _5: u32;
let mut _7: u32;
} }
} }
} }
} }
scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) { scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) {
debug self => _4; debug self => std::ops::Range<u32>{ .0 => _1, .1 => _2, };
} }
bb0: { bb0: {
_4 = std::ops::Range::<u32> { start: _1, end: _2 }; StorageLive(_4);
StorageLive(_5); _4 = _1;
_5 = move _4;
goto -> bb1; goto -> bb1;
} }
bb1: { bb1: {
StorageLive(_9); StorageLive(_7);
StorageLive(_10);
StorageLive(_8); StorageLive(_8);
StorageLive(_6); StorageLive(_6);
_6 = (_5.0: u32); StorageLive(_5);
StorageLive(_7); _5 = _4;
_7 = (_5.1: u32); _6 = Lt(move _5, _2);
_8 = Lt(move _6, move _7); StorageDead(_5);
StorageDead(_7); switchInt(move _6) -> [0: bb2, otherwise: bb3];
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
} }
bb2: { bb2: {
_9 = Option::<u32>::None; _7 = Option::<u32>::None;
goto -> bb5; goto -> bb5;
} }
bb3: { bb3: {
_10 = (_5.0: u32); _8 = _4;
StorageLive(_11); StorageLive(_9);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; _9 = <u32 as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind unreachable];
} }
bb4: { bb4: {
(_5.0: u32) = move _11; _4 = move _9;
StorageDead(_11); StorageDead(_9);
_9 = Option::<u32>::Some(_10); _7 = Option::<u32>::Some(_8);
goto -> bb5; goto -> bb5;
} }
bb5: { bb5: {
StorageDead(_6);
StorageDead(_8); StorageDead(_8);
StorageDead(_10); _10 = discriminant(_7);
_12 = discriminant(_9); switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb10];
switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
} }
bb6: { bb6: {
StorageDead(_9); StorageDead(_7);
StorageDead(_5); StorageDead(_4);
drop(_3) -> [return: bb7, unwind unreachable]; drop(_3) -> [return: bb7, unwind unreachable];
} }
@ -101,18 +94,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
} }
bb8: { bb8: {
_13 = ((_9 as Some).0: u32); _11 = ((_7 as Some).0: u32);
StorageLive(_14); StorageLive(_12);
_14 = &_3; _12 = &_3;
StorageLive(_15); StorageLive(_13);
_15 = (_13,); _13 = (_11,);
_16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind unreachable]; _14 = <impl Fn(u32) as Fn<(u32,)>>::call(move _12, move _13) -> [return: bb9, unwind unreachable];
} }
bb9: { bb9: {
StorageDead(_15); StorageDead(_13);
StorageDead(_14); StorageDead(_12);
StorageDead(_9); StorageDead(_7);
goto -> bb1; goto -> bb1;
} }

View file

@ -5,94 +5,87 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
debug end => _2; debug end => _2;
debug f => _3; debug f => _3;
let mut _0: (); let mut _0: ();
let mut _4: std::ops::Range<u32>; let mut _4: u32;
let mut _5: std::ops::Range<u32>; let mut _7: std::option::Option<u32>;
let mut _9: std::option::Option<u32>; let mut _10: isize;
let mut _12: isize; let mut _12: &impl Fn(u32);
let mut _14: &impl Fn(u32); let mut _13: (u32,);
let mut _15: (u32,); let _14: ();
let _16: ();
let mut _17: &mut std::ops::Range<u32>;
scope 1 { scope 1 {
debug iter => _5; debug iter => std::ops::Range<u32>{ .0 => _4, .1 => _2, };
let _13: u32; let _11: u32;
scope 2 { scope 2 {
debug x => _13; debug x => _11;
} }
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
debug self => &_5; debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, };
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => &_5; debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, };
let mut _8: bool; let mut _6: bool;
let _10: u32; let _8: u32;
let mut _11: u32; let mut _9: u32;
scope 6 { scope 6 {
debug old => _10; debug old => _8;
scope 7 { scope 7 {
} }
} }
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
debug self => &((*_17).0: u32); debug self => &_4;
debug other => &((*_17).1: u32); debug other => &_2;
let mut _6: u32; let mut _5: u32;
let mut _7: u32;
} }
} }
} }
} }
scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) { scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) {
debug self => _4; debug self => std::ops::Range<u32>{ .0 => _1, .1 => _2, };
} }
bb0: { bb0: {
_4 = std::ops::Range::<u32> { start: _1, end: _2 }; StorageLive(_4);
StorageLive(_5); _4 = _1;
_5 = move _4;
goto -> bb1; goto -> bb1;
} }
bb1: { bb1: {
StorageLive(_9); StorageLive(_7);
StorageLive(_10);
StorageLive(_8); StorageLive(_8);
StorageLive(_6); StorageLive(_6);
_6 = (_5.0: u32); StorageLive(_5);
StorageLive(_7); _5 = _4;
_7 = (_5.1: u32); _6 = Lt(move _5, _2);
_8 = Lt(move _6, move _7); StorageDead(_5);
StorageDead(_7); switchInt(move _6) -> [0: bb2, otherwise: bb3];
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
} }
bb2: { bb2: {
_9 = Option::<u32>::None; _7 = Option::<u32>::None;
goto -> bb5; goto -> bb5;
} }
bb3: { bb3: {
_10 = (_5.0: u32); _8 = _4;
StorageLive(_11); StorageLive(_9);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11]; _9 = <u32 as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind: bb11];
} }
bb4: { bb4: {
(_5.0: u32) = move _11; _4 = move _9;
StorageDead(_11); StorageDead(_9);
_9 = Option::<u32>::Some(_10); _7 = Option::<u32>::Some(_8);
goto -> bb5; goto -> bb5;
} }
bb5: { bb5: {
StorageDead(_6);
StorageDead(_8); StorageDead(_8);
StorageDead(_10); _10 = discriminant(_7);
_12 = discriminant(_9); switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb10];
switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
} }
bb6: { bb6: {
StorageDead(_9); StorageDead(_7);
StorageDead(_5); StorageDead(_4);
drop(_3) -> [return: bb7, unwind continue]; drop(_3) -> [return: bb7, unwind continue];
} }
@ -101,18 +94,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
} }
bb8: { bb8: {
_13 = ((_9 as Some).0: u32); _11 = ((_7 as Some).0: u32);
StorageLive(_14); StorageLive(_12);
_14 = &_3; _12 = &_3;
StorageLive(_15); StorageLive(_13);
_15 = (_13,); _13 = (_11,);
_16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind: bb11]; _14 = <impl Fn(u32) as Fn<(u32,)>>::call(move _12, move _13) -> [return: bb9, unwind: bb11];
} }
bb9: { bb9: {
StorageDead(_15); StorageDead(_13);
StorageDead(_14); StorageDead(_12);
StorageDead(_9); StorageDead(_7);
goto -> bb1; goto -> bb1;
} }

View file

@ -5,103 +5,95 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug f => _2; debug f => _2;
let mut _0: (); let mut _0: ();
let mut _3: usize; let mut _3: usize;
let mut _4: std::ops::Range<usize>; let mut _4: usize;
let mut _5: std::ops::Range<usize>; let mut _7: std::option::Option<usize>;
let mut _9: std::option::Option<usize>; let mut _10: isize;
let mut _12: isize; let mut _12: usize;
let mut _14: usize; let mut _13: bool;
let mut _15: bool; let mut _15: &impl Fn(usize, &T);
let mut _17: &impl Fn(usize, &T); let mut _16: (usize, &T);
let mut _18: (usize, &T); let _17: ();
let _19: (); let mut _18: usize;
let mut _20: &mut std::ops::Range<usize>;
scope 1 { scope 1 {
debug iter => _5; debug iter => std::ops::Range<usize>{ .0 => _4, .1 => _3, };
let _13: usize; let _11: usize;
scope 2 { scope 2 {
debug i => _13; debug i => _11;
let _16: &T; let _14: &T;
scope 3 { scope 3 {
debug x => _16; debug x => _14;
} }
} }
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
debug self => &_5; debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, };
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => &_5; debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, };
let mut _8: bool; let mut _6: bool;
let _10: usize; let _8: usize;
let mut _11: usize; let mut _9: usize;
scope 7 { scope 7 {
debug old => _10; debug old => _8;
scope 8 { scope 8 {
} }
} }
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
debug self => &((*_20).0: usize); debug self => &_4;
debug other => &((*_20).1: usize); debug other => &_3;
let mut _6: usize; let mut _5: usize;
let mut _7: usize;
} }
} }
} }
} }
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
debug self => _4; debug self => std::ops::Range<usize>{ .0 => _18, .1 => _3, };
} }
bb0: { bb0: {
StorageLive(_3);
_3 = Len((*_1)); _3 = Len((*_1));
_4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 }; StorageLive(_4);
StorageDead(_3); _4 = const 0_usize;
StorageLive(_5);
_5 = move _4;
goto -> bb1; goto -> bb1;
} }
bb1: { bb1: {
StorageLive(_9); StorageLive(_7);
StorageLive(_10);
StorageLive(_8); StorageLive(_8);
StorageLive(_6); StorageLive(_6);
_6 = (_5.0: usize); StorageLive(_5);
StorageLive(_7); _5 = _4;
_7 = (_5.1: usize); _6 = Lt(move _5, _3);
_8 = Lt(move _6, move _7); StorageDead(_5);
StorageDead(_7); switchInt(move _6) -> [0: bb2, otherwise: bb3];
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
} }
bb2: { bb2: {
_9 = Option::<usize>::None; _7 = Option::<usize>::None;
goto -> bb5; goto -> bb5;
} }
bb3: { bb3: {
_10 = (_5.0: usize); _8 = _4;
StorageLive(_11); StorageLive(_9);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; _9 = <usize as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind unreachable];
} }
bb4: { bb4: {
(_5.0: usize) = move _11; _4 = move _9;
StorageDead(_11); StorageDead(_9);
_9 = Option::<usize>::Some(_10); _7 = Option::<usize>::Some(_8);
goto -> bb5; goto -> bb5;
} }
bb5: { bb5: {
StorageDead(_6);
StorageDead(_8); StorageDead(_8);
StorageDead(_10); _10 = discriminant(_7);
_12 = discriminant(_9); switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11];
switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
} }
bb6: { bb6: {
StorageDead(_9); StorageDead(_7);
StorageDead(_5); StorageDead(_4);
drop(_2) -> [return: bb7, unwind unreachable]; drop(_2) -> [return: bb7, unwind unreachable];
} }
@ -110,25 +102,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
} }
bb8: { bb8: {
_13 = ((_9 as Some).0: usize); _11 = ((_7 as Some).0: usize);
_14 = Len((*_1)); _12 = Len((*_1));
_15 = Lt(_13, _14); _13 = Lt(_11, _12);
assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable]; assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb9, unwind unreachable];
} }
bb9: { bb9: {
_16 = &(*_1)[_13]; _14 = &(*_1)[_11];
StorageLive(_17); StorageLive(_15);
_17 = &_2; _15 = &_2;
StorageLive(_18); StorageLive(_16);
_18 = (_13, _16); _16 = (_11, _14);
_19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind unreachable]; _17 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _15, move _16) -> [return: bb10, unwind unreachable];
} }
bb10: { bb10: {
StorageDead(_18); StorageDead(_16);
StorageDead(_17); StorageDead(_15);
StorageDead(_9); StorageDead(_7);
goto -> bb1; goto -> bb1;
} }

View file

@ -5,103 +5,95 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug f => _2; debug f => _2;
let mut _0: (); let mut _0: ();
let mut _3: usize; let mut _3: usize;
let mut _4: std::ops::Range<usize>; let mut _4: usize;
let mut _5: std::ops::Range<usize>; let mut _7: std::option::Option<usize>;
let mut _9: std::option::Option<usize>; let mut _10: isize;
let mut _12: isize; let mut _12: usize;
let mut _14: usize; let mut _13: bool;
let mut _15: bool; let mut _15: &impl Fn(usize, &T);
let mut _17: &impl Fn(usize, &T); let mut _16: (usize, &T);
let mut _18: (usize, &T); let _17: ();
let _19: (); let mut _18: usize;
let mut _20: &mut std::ops::Range<usize>;
scope 1 { scope 1 {
debug iter => _5; debug iter => std::ops::Range<usize>{ .0 => _4, .1 => _3, };
let _13: usize; let _11: usize;
scope 2 { scope 2 {
debug i => _13; debug i => _11;
let _16: &T; let _14: &T;
scope 3 { scope 3 {
debug x => _16; debug x => _14;
} }
} }
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
debug self => &_5; debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, };
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => &_5; debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, };
let mut _8: bool; let mut _6: bool;
let _10: usize; let _8: usize;
let mut _11: usize; let mut _9: usize;
scope 7 { scope 7 {
debug old => _10; debug old => _8;
scope 8 { scope 8 {
} }
} }
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
debug self => &((*_20).0: usize); debug self => &_4;
debug other => &((*_20).1: usize); debug other => &_3;
let mut _6: usize; let mut _5: usize;
let mut _7: usize;
} }
} }
} }
} }
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
debug self => _4; debug self => std::ops::Range<usize>{ .0 => _18, .1 => _3, };
} }
bb0: { bb0: {
StorageLive(_3);
_3 = Len((*_1)); _3 = Len((*_1));
_4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 }; StorageLive(_4);
StorageDead(_3); _4 = const 0_usize;
StorageLive(_5);
_5 = move _4;
goto -> bb1; goto -> bb1;
} }
bb1: { bb1: {
StorageLive(_9); StorageLive(_7);
StorageLive(_10);
StorageLive(_8); StorageLive(_8);
StorageLive(_6); StorageLive(_6);
_6 = (_5.0: usize); StorageLive(_5);
StorageLive(_7); _5 = _4;
_7 = (_5.1: usize); _6 = Lt(move _5, _3);
_8 = Lt(move _6, move _7); StorageDead(_5);
StorageDead(_7); switchInt(move _6) -> [0: bb2, otherwise: bb3];
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
} }
bb2: { bb2: {
_9 = Option::<usize>::None; _7 = Option::<usize>::None;
goto -> bb5; goto -> bb5;
} }
bb3: { bb3: {
_10 = (_5.0: usize); _8 = _4;
StorageLive(_11); StorageLive(_9);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12]; _9 = <usize as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind: bb12];
} }
bb4: { bb4: {
(_5.0: usize) = move _11; _4 = move _9;
StorageDead(_11); StorageDead(_9);
_9 = Option::<usize>::Some(_10); _7 = Option::<usize>::Some(_8);
goto -> bb5; goto -> bb5;
} }
bb5: { bb5: {
StorageDead(_6);
StorageDead(_8); StorageDead(_8);
StorageDead(_10); _10 = discriminant(_7);
_12 = discriminant(_9); switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11];
switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
} }
bb6: { bb6: {
StorageDead(_9); StorageDead(_7);
StorageDead(_5); StorageDead(_4);
drop(_2) -> [return: bb7, unwind continue]; drop(_2) -> [return: bb7, unwind continue];
} }
@ -110,25 +102,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
} }
bb8: { bb8: {
_13 = ((_9 as Some).0: usize); _11 = ((_7 as Some).0: usize);
_14 = Len((*_1)); _12 = Len((*_1));
_15 = Lt(_13, _14); _13 = Lt(_11, _12);
assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind: bb12]; assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb9, unwind: bb12];
} }
bb9: { bb9: {
_16 = &(*_1)[_13]; _14 = &(*_1)[_11];
StorageLive(_17); StorageLive(_15);
_17 = &_2; _15 = &_2;
StorageLive(_18); StorageLive(_16);
_18 = (_13, _16); _16 = (_11, _14);
_19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind: bb12]; _17 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _15, move _16) -> [return: bb10, unwind: bb12];
} }
bb10: { bb10: {
StorageDead(_18); StorageDead(_16);
StorageDead(_17); StorageDead(_15);
StorageDead(_9); StorageDead(_7);
goto -> bb1; goto -> bb1;
} }