• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1- // MIR for `main` before Inline
2+ // MIR for `main` after Inline
3
4  fn main() -> () {
5      let mut _0: ();
6      let _1: std::boxed::Box<std::vec::Vec<u32>>;
7      let mut _2: std::vec::Vec<u32>;
8      scope 1 {
9          debug _x => _1;
10      }
11+     scope 2 (inlined Vec::<u32>::new) {
12+         let mut _3: alloc::raw_vec::RawVec<u32>;
13+     }
14+     scope 3 (inlined Box::<Vec<u32>>::new) {
15+         debug x => _2;
16+         let mut _4: usize;
17+         let mut _5: usize;
18+         let mut _6: *mut u8;
19+         let mut _7: *const std::vec::Vec<u32>;
20+         scope 4 {
21+             scope 5 (inlined alloc::alloc::exchange_malloc) {
22+                 debug size => _4;
23+                 debug align => _5;
24+                 let _8: std::alloc::Layout;
25+                 let mut _9: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
26+                 let mut _10: isize;
27+                 let mut _12: !;
28+                 scope 6 {
29+                     debug layout => _8;
30+                     let _11: std::ptr::NonNull<[u8]>;
31+                     let mut _13: &std::alloc::Global;
32+                     scope 8 {
33+                         debug ptr => _11;
34+                         scope 18 (inlined NonNull::<[u8]>::as_mut_ptr) {
35+                             debug self => _11;
36+                             let mut _16: std::ptr::NonNull<u8>;
37+                             scope 19 (inlined NonNull::<[u8]>::as_non_null_ptr) {
38+                                 debug self => _11;
39+                                 let mut _17: *mut u8;
40+                                 let mut _18: *mut [u8];
41+                                 scope 20 {
42+                                     scope 21 (inlined NonNull::<[u8]>::as_ptr) {
43+                                         debug self => _11;
44+                                         let mut _19: *const [u8];
45+                                     }
46+                                     scope 22 (inlined ptr::mut_ptr::<impl *mut [u8]>::as_mut_ptr) {
47+                                         debug self => _18;
48+                                     }
49+                                     scope 23 (inlined NonNull::<u8>::new_unchecked) {
50+                                         debug ptr => _17;
51+                                         let mut _20: *const u8;
52+                                         let mut _21: *mut u8;
53+                                         scope 24 {
54+                                             scope 25 (inlined NonNull::<T>::new_unchecked::runtime::<u8>) {
55+                                                 debug ptr => _21;
56+                                                 scope 26 (inlined ptr::mut_ptr::<impl *mut u8>::is_null) {
57+                                                     debug self => _21;
58+                                                     let mut _22: *mut u8;
59+                                                     scope 27 {
60+                                                         scope 28 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
61+                                                             debug ptr => _22;
62+                                                             scope 29 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
63+                                                                 debug self => _22;
64+                                                                 scope 30 {
65+                                                                     scope 31 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
66+                                                                         debug self => _22;
67+                                                                     }
68+                                                                 }
69+                                                             }
70+                                                         }
71+                                                     }
72+                                                 }
73+                                             }
74+                                         }
75+                                     }
76+                                 }
77+                             }
78+                             scope 32 (inlined NonNull::<u8>::as_ptr) {
79+                                 debug self => _16;
80+                                 let mut _23: *const u8;
81+                             }
82+                         }
83+                     }
84+                     scope 17 (inlined <std::alloc::Global as Allocator>::allocate) {
85+                         debug self => const _;
86+                         debug layout => _8;
87+                     }
88+                 }
89+                 scope 7 {
90+                     scope 9 (inlined Layout::from_size_align_unchecked) {
91+                         debug size => _4;
92+                         debug align => _5;
93+                         let mut _14: std::ptr::Alignment;
94+                         scope 10 {
95+                             scope 11 (inlined std::ptr::Alignment::new_unchecked) {
96+                                 debug align => _5;
97+                                 let mut _15: usize;
98+                                 scope 12 {
99+                                     scope 14 (inlined std::ptr::Alignment::new_unchecked::runtime) {
100+                                         debug align => _15;
101+                                         scope 15 (inlined core::num::<impl usize>::is_power_of_two) {
102+                                             debug self => _15;
103+                                             scope 16 (inlined core::num::<impl usize>::count_ones) {
104+                                                 debug self => _15;
105+                                             }
106+                                         }
107+                                     }
108+                                 }
109+                                 scope 13 {
110+                                 }
111+                             }
112+                         }
113+                     }
114+                 }
115+             }
116+         }
117+     }
118
119      bb0: {
120          StorageLive(_1);
121          StorageLive(_2);
122-         _2 = Vec::<u32>::new() -> [return: bb1, unwind unreachable];
123+         StorageLive(_3);
124+         _3 = const _;
125+         _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
126+         StorageDead(_3);
127+         _4 = SizeOf(std::vec::Vec<u32>);
128+         _5 = AlignOf(std::vec::Vec<u32>);
129+         StorageLive(_8);
130+         StorageLive(_11);
131+         StorageLive(_12);
132+         StorageLive(_13);
133+         StorageLive(_14);
134+         StorageLive(_15);
135+         _14 = _5 as std::ptr::Alignment (Transmute);
136+         StorageDead(_15);
137+         _8 = Layout { size: _4, align: move _14 };
138+         StorageDead(_14);
139+         StorageLive(_9);
140+         _13 = const _;
141+         _9 = std::alloc::Global::alloc_impl(_13, _8, const false) -> [return: bb5, unwind unreachable];
142      }
143
144      bb1: {
145-         _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind unreachable];
146+         StorageDead(_1);
147+         return;
148      }
149
150      bb2: {
151+         _12 = handle_alloc_error(_8) -> unwind unreachable;
152+     }
153+
154+     bb3: {
155+         unreachable;
156+     }
157+
158+     bb4: {
159+         _11 = ((_9 as Ok).0: std::ptr::NonNull<[u8]>);
160+         StorageLive(_16);
161+         StorageLive(_17);
162+         StorageLive(_18);
163+         StorageLive(_19);
164+         _19 = (_11.0: *const [u8]);
165+         _18 = move _19 as *mut [u8] (PtrToPtr);
166+         StorageDead(_19);
167+         _17 = _18 as *mut u8 (PtrToPtr);
168+         StorageDead(_18);
169+         StorageLive(_20);
170+         StorageLive(_21);
171+         StorageLive(_22);
172+         _20 = _17 as *const u8 (PointerCoercion(MutToConstPointer));
173+         _16 = NonNull::<u8> { pointer: _20 };
174+         StorageDead(_22);
175+         StorageDead(_21);
176+         StorageDead(_20);
177+         StorageDead(_17);
178+         StorageLive(_23);
179+         _23 = (_16.0: *const u8);
180+         _6 = move _23 as *mut u8 (PtrToPtr);
181+         StorageDead(_23);
182+         StorageDead(_16);
183+         StorageDead(_9);
184+         StorageDead(_13);
185+         StorageDead(_12);
186+         StorageDead(_11);
187+         StorageDead(_8);
188+         _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
189+         _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
190+         (*_7) = move _2;
191          StorageDead(_2);
192          _0 = const ();
193-         drop(_1) -> [return: bb3, unwind unreachable];
194+         drop(_1) -> [return: bb1, unwind unreachable];
195      }
196
197-     bb3: {
198-         StorageDead(_1);
199-         return;
200+     bb5: {
201+         _10 = discriminant(_9);
202+         switchInt(move _10) -> [0: bb4, 1: bb2, otherwise: bb3];
203      }
204  }
205
206