get rid of real_drop_in_place again
This commit is contained in:
parent
fb4ac14c5e
commit
79359315d6
1 changed files with 2 additions and 12 deletions
|
@ -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`
|
/// i.e., you do not usually have to worry about such issues unless you call `drop_in_place`
|
||||||
/// manually.
|
/// manually.
|
||||||
#[stable(feature = "drop_in_place", since = "1.8.0")]
|
#[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"]
|
#[lang = "drop_in_place"]
|
||||||
#[allow(unconditional_recursion)]
|
#[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
|
// Code here does not matter - this is replaced by the
|
||||||
// real drop glue by the compiler.
|
// real drop glue by the compiler.
|
||||||
real_drop_in_place(to_drop)
|
drop_in_place(to_drop)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a null raw pointer.
|
/// Creates a null raw pointer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue