summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir
blob: 1e4f7485089ec7d629e131ea763d1283d2f4b78c (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
// MIR for `foo` after PreCodegen

fn foo(_1: Option<String>) -> i32 {
    debug s => _1;
    let mut _0: i32;
    let mut _2: bool;
    let mut _3: isize;
    let mut _4: &std::string::String;
    let mut _5: &str;
    let mut _6: bool;
    let _7: std::option::Option<std::string::String>;
    scope 1 {
        debug s => _7;
    }

    bb0: {
        _2 = const false;
        _2 = const true;
        _3 = discriminant(_1);
        switchInt(move _3) -> [1: bb1, otherwise: bb5];
    }

    bb1: {
        _4 = &((_1 as Some).0: std::string::String);
        _5 = <String as Deref>::deref(move _4) -> [return: bb2, unwind unreachable];
    }

    bb2: {
        _6 = <str as PartialEq>::eq(_5, const "a") -> [return: bb3, unwind unreachable];
    }

    bb3: {
        switchInt(move _6) -> [0: bb5, otherwise: bb4];
    }

    bb4: {
        _0 = const 1234_i32;
        goto -> bb7;
    }

    bb5: {
        StorageLive(_7);
        _2 = const false;
        _7 = move _1;
        _0 = const 4321_i32;
        drop(_7) -> [return: bb6, unwind unreachable];
    }

    bb6: {
        StorageDead(_7);
        goto -> bb7;
    }

    bb7: {
        switchInt(_2) -> [0: bb9, otherwise: bb8];
    }

    bb8: {
        drop(_1) -> [return: bb9, unwind unreachable];
    }

    bb9: {
        return;
    }
}