Skip to content

Commit 48e3da6

Browse files
committed
remove dead code: requires_move_before_drop
1 parent f2951e6 commit 48e3da6

File tree

4 files changed

+3
-24
lines changed

4 files changed

+3
-24
lines changed

src/libstd/sys/redox/fast_thread_local.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,3 @@ pub unsafe extern fn destroy_value<T>(ptr: *mut u8) {
105105
ptr::drop_in_place((*ptr).inner.get());
106106
}
107107
}
108-
109-
pub fn requires_move_before_drop() -> bool {
110-
false
111-
}

src/libstd/sys/unix/fast_thread_local.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,3 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
8282
}
8383
}
8484
}
85-
86-
pub fn requires_move_before_drop() -> bool {
87-
false
88-
}

src/libstd/sys/windows/fast_thread_local.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@
22
#![cfg(target_thread_local)]
33

44
pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor;
5-
6-
pub fn requires_move_before_drop() -> bool {
7-
false
8-
}

src/libstd/thread/local.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub mod fast {
344344
use crate::fmt;
345345
use crate::mem;
346346
use crate::ptr;
347-
use crate::sys::fast_thread_local::{register_dtor, requires_move_before_drop};
347+
use crate::sys::fast_thread_local::register_dtor;
348348

349349
pub struct Key<T> {
350350
inner: UnsafeCell<Option<T>>,
@@ -395,17 +395,8 @@ pub mod fast {
395395
// destructor as running for this thread so calls to `get` will return
396396
// `None`.
397397
(*ptr).dtor_running.set(true);
398-
399-
// Some implementations may require us to move the value before we drop
400-
// it as it could get re-initialized in-place during destruction.
401-
//
402-
// Hence, we use `ptr::read` on those platforms (to move to a "safe"
403-
// location) instead of drop_in_place.
404-
if requires_move_before_drop() {
405-
ptr::read((*ptr).inner.get());
406-
} else {
407-
ptr::drop_in_place((*ptr).inner.get());
408-
}
398+
399+
ptr::drop_in_place((*ptr).inner.get());
409400
}
410401
}
411402

0 commit comments

Comments
 (0)