fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// MIR for `test` before ElaborateDrops 2 3fn test() -> Option<Box<u32>> { 4 let mut _0: std::option::Option<std::boxed::Box<u32>>; 5 let mut _1: std::boxed::Box<u32>; 6 let mut _2: usize; 7 let mut _3: usize; 8 let mut _4: *mut u8; 9 let mut _5: std::boxed::Box<u32>; 10 let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; 11 let mut _7: std::option::Option<u32>; 12 let mut _8: isize; 13 let _9: std::option::Option<std::convert::Infallible>; 14 let mut _10: !; 15 let mut _11: std::option::Option<std::convert::Infallible>; 16 let _12: u32; 17 scope 1 { 18 } 19 scope 2 { 20 debug residual => _9; 21 scope 3 { 22 } 23 } 24 scope 4 { 25 debug val => _12; 26 scope 5 { 27 } 28 } 29 30 bb0: { 31 StorageLive(_1); 32 _2 = SizeOf(u32); 33 _3 = AlignOf(u32); 34 _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue]; 35 } 36 37 bb1: { 38 StorageLive(_5); 39 _5 = ShallowInitBox(move _4, u32); 40 StorageLive(_6); 41 StorageLive(_7); 42 _7 = Option::<u32>::None; 43 _6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; 44 } 45 46 bb2: { 47 StorageDead(_7); 48 _8 = discriminant(_6); 49 switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; 50 } 51 52 bb3: { 53 StorageLive(_12); 54 _12 = ((_6 as Continue).0: u32); 55 (*_5) = _12; 56 StorageDead(_12); 57 _1 = move _5; 58 drop(_5) -> [return: bb7, unwind: bb11]; 59 } 60 61 bb4: { 62 unreachable; 63 } 64 65 bb5: { 66 StorageLive(_9); 67 _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); 68 StorageLive(_11); 69 _11 = _9; 70 _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; 71 } 72 73 bb6: { 74 StorageDead(_11); 75 StorageDead(_9); 76 drop(_5) -> [return: bb9, unwind continue]; 77 } 78 79 bb7: { 80 StorageDead(_5); 81 _0 = Option::<Box<u32>>::Some(move _1); 82 drop(_1) -> [return: bb8, unwind continue]; 83 } 84 85 bb8: { 86 StorageDead(_1); 87 StorageDead(_6); 88 goto -> bb10; 89 } 90 91 bb9: { 92 StorageDead(_5); 93 StorageDead(_1); 94 StorageDead(_6); 95 goto -> bb10; 96 } 97 98 bb10: { 99 return; 100 } 101 102 bb11 (cleanup): { 103 drop(_1) -> [return: bb13, unwind terminate(cleanup)]; 104 } 105 106 bb12 (cleanup): { 107 drop(_5) -> [return: bb13, unwind terminate(cleanup)]; 108 } 109 110 bb13 (cleanup): { 111 resume; 112 } 113}