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