diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-01-20 11:14:46 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-20 11:14:46 +0530 |
| commit | 5d8edc99aabf5c69304b217daabf41b6bd813a41 (patch) | |
| tree | 0b60379849f524d1ef2f731675eae1a5e8e50f13 /src/libcore | |
| parent | 0dc2557c1202a89f10eec424bb2625bd1615319d (diff) | |
| parent | 95934937bb32190c70ce48915cac14bb4609336d (diff) | |
Rollup merge of #68335 - RalfJung:drop-in-place, r=Mark-Simulacrum
Remove real_drop_in_place In https://github.com/rust-lang/rust/commit/af9b057156f610df3528a502c668cfed99ce8a1a, I added `real_drop_in_place` because Stacked Borrows at the time couldn't handle transmuting of mutable references to raw pointers and back. Stacked Borrows 2, however, doesn't have any issue with these transmutes, so it is time to remove this hack again.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/ptr/mod.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index d7b351f1345..c1976868bf7 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -169,22 +169,12 @@ mod mut_ptr; /// i.e., you do not usually have to worry about such issues unless you call `drop_in_place` /// manually. #[stable(feature = "drop_in_place", since = "1.8.0")] -#[inline(always)] -pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { - real_drop_in_place(&mut *to_drop) -} - -// The real `drop_in_place` -- the one that gets called implicitly when variables go -// out of scope -- should have a safe reference and not a raw pointer as argument -// type. When we drop a local variable, we access it with a pointer that behaves -// like a safe reference; transmuting that to a raw pointer does not mean we can -// actually access it with raw pointers. #[lang = "drop_in_place"] #[allow(unconditional_recursion)] -unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) { +pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { // Code here does not matter - this is replaced by the // real drop glue by the compiler. - real_drop_in_place(to_drop) + drop_in_place(to_drop) } /// Creates a null raw pointer. |
