diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-05-06 01:44:27 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-05-06 01:53:54 -0700 |
| commit | 61517dbbe6f1f41c935007fcdca5eba8be7477e2 (patch) | |
| tree | bbcadd803f973066e2ce1fc75ce4ab32fed35864 /tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff | |
| parent | d287f3e4eeaf680e8fe875f1ec75cca68f357d30 (diff) | |
| download | rust-61517dbbe6f1f41c935007fcdca5eba8be7477e2.tar.gz rust-61517dbbe6f1f41c935007fcdca5eba8be7477e2.zip | |
Avoid a cast in `ptr::slice_from_raw_parts(_mut)`
Casting to `*const ()` or `*mut ()` just bloats the MIR, so let's not. If ACP#362 goes through we can keep calling `ptr::from_raw_parts(_mut)` in these also without the cast, but that hasn't had any libs-api attention yet, so I'm not waiting on it.
Diffstat (limited to 'tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff')
| -rw-r--r-- | tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff index 2a36ccaab11..df873600577 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -11,10 +11,28 @@ + scope 1 (inlined std::ptr::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) { ++ let mut _11: &alloc::raw_vec::RawVec<A>; ++ scope 4 (inlined alloc::raw_vec::RawVec::<A>::ptr) { ++ let mut _13: std::ptr::NonNull<A>; ++ scope 5 (inlined Unique::<A>::as_ptr) { ++ scope 6 (inlined NonNull::<A>::as_ptr) { ++ let mut _12: *const A; ++ } ++ } ++ } ++ } ++ scope 7 (inlined slice_from_raw_parts_mut::<A>) { ++ } ++ } + } -+ scope 2 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) { -+ let mut _8: isize; -+ let mut _9: isize; ++ scope 8 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) { ++ let mut _14: isize; ++ let mut _15: isize; + } bb0: { @@ -25,7 +43,24 @@ + StorageLive(_6); + StorageLive(_7); + _6 = &mut (*_4); -+ _7 = <Vec<A> as Drop>::drop(move _6) -> [return: bb2, unwind unreachable]; ++ StorageLive(_8); ++ StorageLive(_9); ++ StorageLive(_11); ++ _11 = &((*_6).0: alloc::raw_vec::RawVec<A>); ++ StorageLive(_13); ++ _13 = ((((*_6).0: alloc::raw_vec::RawVec<A>).0: std::ptr::Unique<A>).0: std::ptr::NonNull<A>); ++ StorageLive(_12); ++ _12 = (_13.0: *const A); ++ _9 = move _12 as *mut A (PtrToPtr); ++ StorageDead(_12); ++ StorageDead(_13); ++ StorageDead(_11); ++ StorageLive(_10); ++ _10 = ((*_6).1: usize); ++ _8 = *mut [A] from (_9, _10); ++ StorageDead(_10); ++ StorageDead(_9); ++ _7 = std::ptr::drop_in_place::<[A]>(move _8) -> [return: bb2, unwind unreachable]; } bb1: { @@ -36,19 +71,20 @@ StorageLive(_5); _5 = _2; - _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable]; -+ StorageLive(_8); -+ StorageLive(_9); -+ _8 = discriminant((*_5)); -+ switchInt(move _8) -> [0: bb3, otherwise: bb4]; ++ StorageLive(_14); ++ StorageLive(_15); ++ _14 = discriminant((*_5)); ++ switchInt(move _14) -> [0: bb3, otherwise: bb4]; } bb2: { ++ StorageDead(_8); + drop(((*_4).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable]; + } + + bb3: { -+ StorageDead(_9); -+ StorageDead(_8); ++ StorageDead(_15); ++ StorageDead(_14); StorageDead(_5); return; + } |
