rust/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff
2025-04-22 14:06:09 +02:00

124 lines
4.1 KiB
Diff

- // MIR for `drop` before Inline
+ // MIR for `drop` after Inline
fn drop(_1: *mut Vec<A>, _2: *mut Option<B>) -> () {
debug a => _1;
debug b => _2;
let mut _0: ();
let _3: ();
let mut _4: *mut std::vec::Vec<A>;
let mut _5: *mut std::option::Option<B>;
+ scope 1 (inlined drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) {
+ let mut _6: &mut std::vec::Vec<A>;
+ let mut _7: ();
+ scope 2 (inlined <Vec<A> as Drop>::drop) {
+ let mut _8: *mut [A];
+ let mut _9: *mut A;
+ let mut _10: usize;
+ scope 3 (inlined Vec::<A>::as_mut_ptr) {
+ scope 4 (inlined alloc::raw_vec::RawVec::<A>::ptr) {
+ scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<A>) {
+ scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<A>) {
+ let mut _11: std::ptr::NonNull<u8>;
+ scope 7 (inlined Unique::<u8>::cast::<A>) {
+ scope 8 (inlined NonNull::<u8>::cast::<A>) {
+ scope 9 (inlined NonNull::<u8>::as_ptr) {
+ }
+ }
+ }
+ scope 10 (inlined Unique::<A>::as_non_null_ptr) {
+ }
+ }
+ scope 11 (inlined NonNull::<A>::as_ptr) {
+ }
+ }
+ }
+ }
+ scope 12 (inlined slice_from_raw_parts_mut::<A>) {
+ scope 13 (inlined std::ptr::from_raw_parts_mut::<[A], A>) {
+ }
+ }
+ scope 14 (inlined drop_in_place::<[A]> - shim(Some([A]))) {
+ let mut _12: usize;
+ let mut _13: *mut A;
+ let mut _14: bool;
+ }
+ }
+ }
+ scope 15 (inlined drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
+ let mut _15: isize;
+ let mut _16: isize;
+ }
bb0: {
StorageLive(_3);
StorageLive(_4);
_4 = copy _1;
- _3 = drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind unreachable];
+ StorageLive(_6);
+ StorageLive(_7);
+ _6 = &mut (*_4);
+ StorageLive(_10);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_11);
+ _11 = copy (((((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
+ _9 = copy _11 as *mut A (Transmute);
+ StorageDead(_11);
+ _10 = copy ((*_6).1: usize);
+ _8 = *mut [A] from (copy _9, copy _10);
+ StorageDead(_9);
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _12 = const 0_usize;
+ goto -> bb4;
}
bb1: {
+ StorageDead(_7);
+ StorageDead(_6);
StorageDead(_4);
StorageDead(_3);
StorageLive(_5);
_5 = copy _2;
- _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable];
+ StorageLive(_15);
+ StorageLive(_16);
+ _15 = discriminant((*_5));
+ switchInt(move _15) -> [0: bb5, otherwise: bb6];
}
bb2: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_8);
+ StorageDead(_10);
+ drop(((*_4).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb3: {
+ _13 = &raw mut (*_8)[_12];
+ _12 = Add(move _12, const 1_usize);
+ drop((*_13)) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ _14 = Eq(copy _12, copy _10);
+ switchInt(move _14) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb5: {
+ StorageDead(_16);
+ StorageDead(_15);
StorageDead(_5);
return;
+ }
+
+ bb6: {
+ drop((((*_5) as Some).0: B)) -> [return: bb5, unwind unreachable];
}
}