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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 lines
2.6 KiB
Rust
Raw Normal View History

2020-04-02 16:09:01 -05:00
// MIR for `test` before ElaborateDrops
fn test() -> Option<Box<u32>> {
2023-06-06 08:47:00 -05:00
let mut _0: std::option::Option<std::boxed::Box<u32>>;
let mut _1: std::boxed::Box<u32>;
let mut _2: usize;
let mut _3: usize;
let mut _4: *mut u8;
let mut _5: std::boxed::Box<u32>;
let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>;
let mut _7: std::option::Option<u32>;
let mut _8: isize;
let _9: std::option::Option<std::convert::Infallible>;
let mut _10: !;
let mut _11: std::option::Option<std::convert::Infallible>;
let _12: u32;
2020-04-02 16:09:01 -05:00
scope 1 {
2023-06-06 08:47:00 -05:00
debug residual => _9;
scope 2 {
2020-04-02 16:09:01 -05:00
}
}
scope 3 {
2023-06-06 08:47:00 -05:00
debug val => _12;
scope 4 {
2020-04-02 16:09:01 -05:00
}
}
bb0: {
2023-06-06 08:47:00 -05:00
StorageLive(_1);
_2 = SizeOf(u32);
_3 = AlignOf(u32);
2023-06-23 11:53:09 -05:00
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
2020-04-02 16:09:01 -05:00
}
2020-10-02 15:11:24 -05:00
bb1: {
2023-06-06 08:47:00 -05:00
StorageLive(_5);
_5 = ShallowInitBox(move _4, u32);
StorageLive(_6);
StorageLive(_7);
_7 = Option::<u32>::None;
_6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12];
}
2020-10-02 15:11:24 -05:00
bb2: {
2023-06-06 08:47:00 -05:00
StorageDead(_7);
PlaceMention(_6);
2023-06-06 08:47:00 -05:00
_8 = discriminant(_6);
2024-02-11 21:56:03 -06:00
switchInt(move _8) -> [0: bb4, 1: bb5, otherwise: bb3];
2020-04-02 16:09:01 -05:00
}
2020-10-02 15:11:24 -05:00
bb3: {
2024-02-11 21:56:03 -06:00
unreachable;
}
bb4: {
2023-06-06 08:47:00 -05:00
StorageLive(_12);
_12 = copy ((_6 as Continue).0: u32);
(*_5) = copy _12;
StorageDead(_12);
_1 = move _5;
drop(_5) -> [return: bb7, unwind: bb11];
2020-04-02 16:09:01 -05:00
}
2020-10-02 15:11:24 -05:00
bb5: {
2023-06-06 08:47:00 -05:00
StorageLive(_9);
_9 = copy ((_6 as Break).0: std::option::Option<std::convert::Infallible>);
StorageLive(_11);
_11 = copy _9;
_0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12];
2020-05-02 13:59:05 -05:00
}
bb6: {
2023-06-06 08:47:00 -05:00
StorageDead(_11);
StorageDead(_9);
2023-06-23 11:53:09 -05:00
drop(_5) -> [return: bb9, unwind continue];
}
bb7: {
2023-06-06 08:47:00 -05:00
StorageDead(_5);
_0 = Option::<Box<u32>>::Some(move _1);
2023-06-23 11:53:09 -05:00
drop(_1) -> [return: bb8, unwind continue];
}
bb8: {
2023-06-06 08:47:00 -05:00
StorageDead(_1);
StorageDead(_6);
goto -> bb10;
2020-04-02 16:09:01 -05:00
}
bb9: {
2023-06-06 08:47:00 -05:00
StorageDead(_5);
StorageDead(_1);
StorageDead(_6);
goto -> bb10;
2020-10-02 15:11:24 -05:00
}
2021-09-16 17:04:02 -05:00
bb10: {
2023-06-06 08:47:00 -05:00
return;
}
bb11 (cleanup): {
2023-08-24 07:26:26 -05:00
drop(_1) -> [return: bb13, unwind terminate(cleanup)];
2020-10-02 15:11:24 -05:00
}
bb12 (cleanup): {
2023-08-24 07:26:26 -05:00
drop(_5) -> [return: bb13, unwind terminate(cleanup)];
2021-09-16 17:04:02 -05:00
}
bb13 (cleanup): {
2023-06-06 08:47:00 -05:00
resume;
2020-04-02 16:09:01 -05:00
}
}