remove dead code: requires_move_before_drop
This commit is contained in:
parent
f2951e6fd7
commit
48e3da6d59
4 changed files with 3 additions and 24 deletions
|
|
@ -105,7 +105,3 @@ pub unsafe extern fn destroy_value<T>(ptr: *mut u8) {
|
|||
ptr::drop_in_place((*ptr).inner.get());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn requires_move_before_drop() -> bool {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,3 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn requires_move_before_drop() -> bool {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,3 @@
|
|||
#![cfg(target_thread_local)]
|
||||
|
||||
pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor;
|
||||
|
||||
pub fn requires_move_before_drop() -> bool {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ pub mod fast {
|
|||
use crate::fmt;
|
||||
use crate::mem;
|
||||
use crate::ptr;
|
||||
use crate::sys::fast_thread_local::{register_dtor, requires_move_before_drop};
|
||||
use crate::sys::fast_thread_local::register_dtor;
|
||||
|
||||
pub struct Key<T> {
|
||||
inner: UnsafeCell<Option<T>>,
|
||||
|
|
@ -395,17 +395,8 @@ pub mod fast {
|
|||
// destructor as running for this thread so calls to `get` will return
|
||||
// `None`.
|
||||
(*ptr).dtor_running.set(true);
|
||||
|
||||
// Some implementations may require us to move the value before we drop
|
||||
// it as it could get re-initialized in-place during destruction.
|
||||
//
|
||||
// Hence, we use `ptr::read` on those platforms (to move to a "safe"
|
||||
// location) instead of drop_in_place.
|
||||
if requires_move_before_drop() {
|
||||
ptr::read((*ptr).inner.get());
|
||||
} else {
|
||||
ptr::drop_in_place((*ptr).inner.get());
|
||||
}
|
||||
|
||||
ptr::drop_in_place((*ptr).inner.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue