rust/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir

108 lines
2.6 KiB
Rust

// MIR for `test` before ElaborateDrops
fn test() -> Option<Box<u32>> {
let mut _0: std::option::Option<std::boxed::Box<u32>>;
let mut _1: std::boxed::Box<u32>;
let mut _2: *mut u8;
let mut _3: std::boxed::Box<u32>;
let mut _4: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>;
let mut _5: std::option::Option<u32>;
let mut _6: isize;
let _7: std::option::Option<std::convert::Infallible>;
let mut _8: !;
let mut _9: std::option::Option<std::convert::Infallible>;
let _10: u32;
scope 1 {
debug residual => _7;
scope 2 {
}
}
scope 3 {
debug val => _10;
scope 4 {
}
}
bb0: {
StorageLive(_1);
_2 = alloc::alloc::exchange_malloc(const <u32 as std::mem::SizedTypeProperties>::SIZE, const <u32 as std::mem::SizedTypeProperties>::ALIGN) -> [return: bb1, unwind: bb13];
}
bb1: {
StorageLive(_3);
_3 = ShallowInitBox(move _2, u32);
StorageLive(_4);
StorageLive(_5);
_5 = Option::<u32>::None;
_4 = <Option<u32> as Try>::branch(move _5) -> [return: bb2, unwind: bb12];
}
bb2: {
StorageDead(_5);
PlaceMention(_4);
_6 = discriminant(_4);
switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb3];
}
bb3: {
unreachable;
}
bb4: {
StorageLive(_10);
_10 = copy ((_4 as Continue).0: u32);
(*_3) = copy _10;
StorageDead(_10);
_1 = move _3;
drop(_3) -> [return: bb7, unwind: bb11];
}
bb5: {
StorageLive(_7);
_7 = copy ((_4 as Break).0: std::option::Option<std::convert::Infallible>);
StorageLive(_9);
_9 = copy _7;
_0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _9) -> [return: bb6, unwind: bb12];
}
bb6: {
StorageDead(_9);
StorageDead(_7);
drop(_3) -> [return: bb9, unwind: bb13];
}
bb7: {
StorageDead(_3);
_0 = Option::<Box<u32>>::Some(move _1);
drop(_1) -> [return: bb8, unwind: bb13];
}
bb8: {
StorageDead(_1);
StorageDead(_4);
goto -> bb10;
}
bb9: {
StorageDead(_3);
StorageDead(_1);
StorageDead(_4);
goto -> bb10;
}
bb10: {
return;
}
bb11 (cleanup): {
drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb12 (cleanup): {
drop(_3) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
resume;
}
}