diff options
| author | tyler <tyler@brainiumstudios.com> | 2019-04-27 07:23:31 -0700 |
|---|---|---|
| committer | tyler <tyler@brainiumstudios.com> | 2019-05-15 07:30:33 -0700 |
| commit | 48e3da6d5910d119d4afefd7d06340390db6968d (patch) | |
| tree | 98e467a58632f4ce3711de11281e5f4b9b6a18c8 /src/libstd/thread | |
| parent | f2951e6fd7fda39948a5c6a9a053f74a8a314a38 (diff) | |
| download | rust-48e3da6d5910d119d4afefd7d06340390db6968d.tar.gz rust-48e3da6d5910d119d4afefd7d06340390db6968d.zip | |
remove dead code: requires_move_before_drop
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 15 |
1 files changed, 3 insertions, 12 deletions
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()); } } |
