about summary refs log tree commit diff
path: root/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
blob: d22ea54004c913dad5b5e5a0e537548357002adb (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
115
116
117
118
119
120
121
122
123
// MIR for `mapped` after PreCodegen

fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
    debug iter => _1;
    debug f => _2;
    let mut _0: ();
    let mut _3: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
    let mut _4: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
    let mut _5: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
    let mut _13: std::option::Option<U>;
    let _15: ();
    scope 1 {
        debug iter => _4;
        let _14: U;
        scope 2 {
            debug x => _14;
        }
        scope 4 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next) {
            debug self => _5;
            let mut _6: &mut impl Iterator<Item = T>;
            let mut _7: std::option::Option<T>;
            let mut _8: &mut impl Fn(T) -> U;
            scope 5 (inlined Option::<T>::map::<U, &mut impl Fn(T) -> U>) {
                debug self => _7;
                debug f => _8;
                let mut _9: isize;
                let _10: T;
                let mut _11: (T,);
                let mut _12: U;
                scope 6 {
                    debug x => _10;
                    scope 7 (inlined ops::function::impls::<impl FnOnce<(T,)> for &mut impl Fn(T) -> U>::call_once) {
                        debug self => _8;
                        debug args => _11;
                    }
                }
            }
        }
    }
    scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) {
        debug self => _3;
    }

    bb0: {
        _3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> [return: bb1, unwind continue];
    }

    bb1: {
        StorageLive(_4);
        _4 = copy _3;
        goto -> bb2;
    }

    bb2: {
        StorageLive(_13);
        _5 = &mut _4;
        StorageLive(_8);
        StorageLive(_7);
        StorageLive(_6);
        _6 = &mut (_4.0: impl Iterator<Item = T>);
        _7 = <impl Iterator<Item = T> as Iterator>::next(move _6) -> [return: bb3, unwind: bb10];
    }

    bb3: {
        StorageDead(_6);
        _8 = &mut (_4.1: impl Fn(T) -> U);
        StorageLive(_9);
        StorageLive(_10);
        _9 = discriminant(_7);
        switchInt(move _9) -> [0: bb4, 1: bb6, otherwise: bb9];
    }

    bb4: {
        StorageDead(_10);
        StorageDead(_9);
        StorageDead(_7);
        StorageDead(_8);
        StorageDead(_13);
        drop(_4) -> [return: bb5, unwind continue];
    }

    bb5: {
        StorageDead(_4);
        return;
    }

    bb6: {
        _10 = move ((_7 as Some).0: T);
        StorageLive(_12);
        StorageLive(_11);
        _11 = (copy _10,);
        _12 = <impl Fn(T) -> U as FnMut<(T,)>>::call_mut(move _8, move _11) -> [return: bb7, unwind: bb10];
    }

    bb7: {
        StorageDead(_11);
        _13 = Option::<U>::Some(move _12);
        StorageDead(_12);
        StorageDead(_10);
        StorageDead(_9);
        StorageDead(_7);
        StorageDead(_8);
        _14 = move ((_13 as Some).0: U);
        _15 = opaque::<U>(move _14) -> [return: bb8, unwind: bb10];
    }

    bb8: {
        StorageDead(_13);
        goto -> bb2;
    }

    bb9: {
        unreachable;
    }

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

    bb11 (cleanup): {
        resume;
    }
}