File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
library/std/src/sys/thread_local/native
tests/ui/threads-sendsync Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 8484 // access to self.value and may replace it.
8585 let mut old_value = unsafe { self . value . get ( ) . replace ( MaybeUninit :: new ( v) ) } ;
8686 match self . state . replace ( State :: Alive ) {
87+ // If the variable is not being recursively initialized, register
88+ // the destructor. This might be a noop if the value does not need
89+ // destruction.
8790 State :: Uninitialized => D :: register_dtor ( self ) ,
91+
92+ // Recursive initialization, we only need to drop the old value
93+ // as we've already registered the destructor.
8894 State :: Alive => unsafe { old_value. assume_init_drop ( ) } ,
95+
8996 State :: Destroyed ( _) => unreachable ! ( ) ,
9097 }
9198
Original file line number Diff line number Diff line change 11//@ run-pass
2- #![ allow( stable_features) ]
32//@ needs-threads
43
54use std:: cell:: Cell ;
You can’t perform that action at this time.
0 commit comments