File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
library/std/src/sys/thread_local Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11use super :: lazy:: LazyKeyInner ;
22use crate :: cell:: Cell ;
33use crate :: sys:: thread_local_dtor:: register_dtor;
4- use crate :: { fmt, mem, panic} ;
4+ use crate :: { fmt, mem, panic, ptr } ;
55
66#[ doc( hidden) ]
77#[ 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) {
237237 // Wrap the call in a catch to ensure unwinding is caught in the event
238238 // a panic takes place in a destructor.
239239 if let Err ( _) = panic:: catch_unwind ( panic:: AssertUnwindSafe ( || unsafe {
240- let value = ( * ptr) . inner . take ( ) ;
241- ( * ptr) . dtor_state . set ( DtorState :: RunningOrHasRun ) ;
240+ let Key { inner, dtor_state } = & * ptr;
241+ let value = inner. take ( ) ;
242+ dtor_state. set ( DtorState :: RunningOrHasRun ) ;
242243 drop ( value) ;
243244 } ) ) {
244245 rtabort ! ( "thread local panicked on drop" ) ;
You can’t perform that action at this time.
0 commit comments