summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
blob: 8f94165a108ef4979e8ecf7e696e445bcbb136c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// 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: 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;
    scope 1 {
    }
    scope 2 {
        debug residual => _9;
        scope 3 {
        }
    }
    scope 4 {
        debug val => _12;
        scope 5 {
        }
    }

    bb0: {
        StorageLive(_1);
        _2 = SizeOf(u32);
        _3 = AlignOf(u32);
        _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
    }

    bb1: {
        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];
    }

    bb2: {
        StorageDead(_7);
        PlaceMention(_6);
        _8 = discriminant(_6);
        switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
    }

    bb3: {
        StorageLive(_12);
        _12 = ((_6 as Continue).0: u32);
        (*_5) = _12;
        StorageDead(_12);
        _1 = move _5;
        drop(_5) -> [return: bb7, unwind: bb11];
    }

    bb4: {
        unreachable;
    }

    bb5: {
        StorageLive(_9);
        _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>);
        StorageLive(_11);
        _11 = _9;
        _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12];
    }

    bb6: {
        StorageDead(_11);
        StorageDead(_9);
        drop(_5) -> [return: bb9, unwind continue];
    }

    bb7: {
        StorageDead(_5);
        _0 = Option::<Box<u32>>::Some(move _1);
        drop(_1) -> [return: bb8, unwind continue];
    }

    bb8: {
        StorageDead(_1);
        StorageDead(_6);
        goto -> bb10;
    }

    bb9: {
        StorageDead(_5);
        StorageDead(_1);
        StorageDead(_6);
        goto -> bb10;
    }

    bb10: {
        return;
    }

    bb11 (cleanup): {
        drop(_1) -> [return: bb13, unwind terminate(cleanup)];
    }

    bb12 (cleanup): {
        drop(_5) -> [return: bb13, unwind terminate(cleanup)];
    }

    bb13 (cleanup): {
        resume;
    }
}