File tree 1 file changed +4
-3
lines changed
library/std/src/sys/thread_local
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
use super :: lazy:: LazyKeyInner ;
2
2
use crate :: cell:: Cell ;
3
3
use crate :: sys:: thread_local_dtor:: register_dtor;
4
- use crate :: { fmt, mem, panic} ;
4
+ use crate :: { fmt, mem, panic, ptr } ;
5
5
6
6
#[ doc( hidden) ]
7
7
#[ 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) {
237
237
// Wrap the call in a catch to ensure unwinding is caught in the event
238
238
// a panic takes place in a destructor.
239
239
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 ) ;
242
243
drop ( value) ;
243
244
} ) ) {
244
245
rtabort ! ( "thread local panicked on drop" ) ;
You can’t perform that action at this time.
0 commit comments