about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-04-25 12:32:11 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-04-25 12:45:21 -0700
commit43f21a6871542df7546d9858d258207d947d3d2c (patch)
tree2eab0a2fa4d55fb55198c34eeea35072fb76f372 /library/std/src
parent538ddb0ac2a3f15ac43bd0444b36b755354f525e (diff)
downloadrust-43f21a6871542df7546d9858d258207d947d3d2c.tar.gz
rust-43f21a6871542df7546d9858d258207d947d3d2c.zip
thread_local: split refs to fields of Key
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/thread_local/fast_local.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/std/src/sys/thread_local/fast_local.rs b/library/std/src/sys/thread_local/fast_local.rs
index 69ee70de30c..49b51a729e4 100644
--- a/library/std/src/sys/thread_local/fast_local.rs
+++ b/library/std/src/sys/thread_local/fast_local.rs
@@ -1,7 +1,7 @@
 use super::lazy::LazyKeyInner;
 use crate::cell::Cell;
 use crate::sys::thread_local_dtor::register_dtor;
-use crate::{fmt, mem, panic};
+use crate::{fmt, mem, panic, ptr};
 
 #[doc(hidden)]
 #[allow_internal_unstable(thread_local_internals, cfg_target_thread_local, thread_local)]
@@ -237,8 +237,9 @@ unsafe extern "C" fn destroy_value<T>(ptr: *mut u8) {
     // Wrap the call in a catch to ensure unwinding is caught in the event
     // a panic takes place in a destructor.
     if let Err(_) = panic::catch_unwind(panic::AssertUnwindSafe(|| unsafe {
-        let value = (*ptr).inner.take();
-        (*ptr).dtor_state.set(DtorState::RunningOrHasRun);
+        let Key { inner, dtor_state } = &*ptr;
+        let value = inner.take();
+        dtor_state.set(DtorState::RunningOrHasRun);
         drop(value);
     })) {
         rtabort!("thread local panicked on drop");