We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65c66a1 commit 88efb1bCopy full SHA for 88efb1b
library/std/src/sys/windows/thread_local_key.rs
@@ -43,6 +43,9 @@ unsafe fn run_keyless_dtors() {
43
// guarantee that a TLS key cannot be set after it is flagged for
44
// destruction.
45
loop {
46
+ // Use a let-else binding to ensure the `RefCell` guard is dropped
47
+ // immediately. Otherwise, a panic would occur if a TLS destructor
48
+ // tries to access the list.
49
let Some((ptr, dtor)) = DESTRUCTORS.borrow_mut().pop() else {
50
break;
51
};
0 commit comments