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 84
84
// access to self.value and may replace it.
85
85
let mut old_value = unsafe { self . value . get ( ) . replace ( MaybeUninit :: new ( v) ) } ;
86
86
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.
87
90
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.
88
94
State :: Alive => unsafe { old_value. assume_init_drop ( ) } ,
95
+
89
96
State :: Destroyed ( _) => unreachable ! ( ) ,
90
97
}
91
98
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
- #![ allow( stable_features) ]
3
2
//@ needs-threads
4
3
5
4
use std:: cell:: Cell ;
You can’t perform that action at this time.
0 commit comments