about summary refs log tree commit diff
diff options
context:
space:
mode:
authortyler <tyler@brainiumstudios.com>2019-04-27 07:23:31 -0700
committertyler <tyler@brainiumstudios.com>2019-05-15 07:30:33 -0700
commit48e3da6d5910d119d4afefd7d06340390db6968d (patch)
tree98e467a58632f4ce3711de11281e5f4b9b6a18c8
parentf2951e6fd7fda39948a5c6a9a053f74a8a314a38 (diff)
downloadrust-48e3da6d5910d119d4afefd7d06340390db6968d.tar.gz
rust-48e3da6d5910d119d4afefd7d06340390db6968d.zip
remove dead code: requires_move_before_drop
-rw-r--r--src/libstd/sys/redox/fast_thread_local.rs4
-rw-r--r--src/libstd/sys/unix/fast_thread_local.rs4
-rw-r--r--src/libstd/sys/windows/fast_thread_local.rs4
-rw-r--r--src/libstd/thread/local.rs15
4 files changed, 3 insertions, 24 deletions
diff --git a/src/libstd/sys/redox/fast_thread_local.rs b/src/libstd/sys/redox/fast_thread_local.rs
index 1202708a476..fd278bfe39a 100644
--- a/src/libstd/sys/redox/fast_thread_local.rs
+++ b/src/libstd/sys/redox/fast_thread_local.rs
@@ -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
-}
diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs
index 17478dce4fe..c34c2e6e786 100644
--- a/src/libstd/sys/unix/fast_thread_local.rs
+++ b/src/libstd/sys/unix/fast_thread_local.rs
@@ -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
-}
diff --git a/src/libstd/sys/windows/fast_thread_local.rs b/src/libstd/sys/windows/fast_thread_local.rs
index 0ccc67e3fd5..31d0bd1e72e 100644
--- a/src/libstd/sys/windows/fast_thread_local.rs
+++ b/src/libstd/sys/windows/fast_thread_local.rs
@@ -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
-}
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
index bfc1deddf7b..0d5e1f2af38 100644
--- a/src/libstd/thread/local.rs
+++ b/src/libstd/thread/local.rs
@@ -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());
     }
 }