fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
5.7 KiB191 linesraw
1// MIR for `forward_loop` after PreCodegen
2
3fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
4    debug slice => _1;
5    debug f => _2;
6    let mut _0: ();
7    let mut _13: std::slice::Iter<'_, T>;
8    let mut _14: std::slice::Iter<'_, T>;
9    let mut _15: &mut std::slice::Iter<'_, T>;
10    let mut _16: std::option::Option<&T>;
11    let mut _17: isize;
12    let mut _19: &impl Fn(&T);
13    let mut _20: (&T,);
14    let _21: ();
15    scope 1 {
16        debug iter => _14;
17        let _18: &T;
18        scope 2 {
19            debug x => _18;
20        }
21    }
22    scope 3 (inlined core::slice::<impl [T]>::iter) {
23        debug self => _1;
24        scope 4 (inlined std::slice::Iter::<'_, T>::new) {
25            debug slice => _1;
26            let _4: *const T;
27            let mut _5: bool;
28            let mut _6: usize;
29            let mut _8: usize;
30            let mut _9: *mut T;
31            let mut _11: std::ptr::NonNull<T>;
32            let mut _12: *const T;
33            scope 5 {
34                debug ptr => _4;
35                scope 6 {
36                    let _7: *const T;
37                    scope 7 {
38                        debug end_or_len => _7;
39                        scope 13 (inlined NonNull::<T>::new_unchecked) {
40                            debug ptr => _9;
41                            let mut _10: *const T;
42                            scope 14 {
43                                scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
44                                    debug ptr => _9;
45                                    scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) {
46                                        debug self => _9;
47                                        let mut _22: *mut u8;
48                                        scope 17 {
49                                            scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
50                                                debug ptr => _22;
51                                                scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
52                                                    debug self => _22;
53                                                    scope 20 {
54                                                        scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
55                                                            debug self => _22;
56                                                        }
57                                                    }
58                                                }
59                                            }
60                                        }
61                                    }
62                                }
63                            }
64                        }
65                    }
66                    scope 9 (inlined invalid::<T>) {
67                        debug addr => _8;
68                        scope 10 {
69                        }
70                    }
71                    scope 11 (inlined ptr::const_ptr::<impl *const T>::add) {
72                        debug self => _4;
73                        debug count => _6;
74                        scope 12 {
75                        }
76                    }
77                }
78            }
79            scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
80                debug self => _1;
81                let mut _3: *const [T];
82            }
83        }
84    }
85    scope 22 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) {
86        debug self => _13;
87    }
88
89    bb0: {
90        StorageLive(_4);
91        StorageLive(_3);
92        _3 = &raw const (*_1);
93        _4 = move _3 as *const T (PtrToPtr);
94        StorageDead(_3);
95        StorageLive(_7);
96        StorageLive(_5);
97        _5 = const _;
98        switchInt(move _5) -> [0: bb1, otherwise: bb2];
99    }
100
101    bb1: {
102        StorageLive(_6);
103        _6 = Len((*_1));
104        _7 = Offset(_4, _6);
105        StorageDead(_6);
106        goto -> bb3;
107    }
108
109    bb2: {
110        StorageLive(_8);
111        _8 = Len((*_1));
112        _7 = _8 as *const T (Transmute);
113        StorageDead(_8);
114        goto -> bb3;
115    }
116
117    bb3: {
118        StorageDead(_5);
119        StorageLive(_11);
120        StorageLive(_9);
121        _9 = _4 as *mut T (PtrToPtr);
122        StorageLive(_10);
123        StorageLive(_22);
124        _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
125        _11 = NonNull::<T> { pointer: _10 };
126        StorageDead(_22);
127        StorageDead(_10);
128        StorageDead(_9);
129        StorageLive(_12);
130        _12 = _7;
131        _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
132        StorageDead(_12);
133        StorageDead(_11);
134        StorageDead(_7);
135        StorageDead(_4);
136        StorageLive(_14);
137        _14 = move _13;
138        goto -> bb4;
139    }
140
141    bb4: {
142        StorageLive(_16);
143        StorageLive(_15);
144        _15 = &mut _14;
145        _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11];
146    }
147
148    bb5: {
149        StorageDead(_15);
150        _17 = discriminant(_16);
151        switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
152    }
153
154    bb6: {
155        StorageDead(_16);
156        StorageDead(_14);
157        drop(_2) -> [return: bb7, unwind continue];
158    }
159
160    bb7: {
161        return;
162    }
163
164    bb8: {
165        _18 = ((_16 as Some).0: &T);
166        StorageLive(_19);
167        _19 = &_2;
168        StorageLive(_20);
169        _20 = (_18,);
170        _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
171    }
172
173    bb9: {
174        StorageDead(_20);
175        StorageDead(_19);
176        StorageDead(_16);
177        goto -> bb4;
178    }
179
180    bb10: {
181        unreachable;
182    }
183
184    bb11 (cleanup): {
185        drop(_2) -> [return: bb12, unwind terminate(cleanup)];
186    }
187
188    bb12 (cleanup): {
189        resume;
190    }
191}