about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2023-10-05 10:58:39 +0200
committerjoboet <jonasboettiger@icloud.com>2023-10-07 16:01:18 +0200
commit65c66a15bf99efc75ea855733b94881953a6b9e8 (patch)
tree5d5efaf9aae4434b9ba3a9e0d3877e5fbee34e66
parentb18990b1e973a1fd0a0318a88655dc1907509b17 (diff)
downloadrust-65c66a15bf99efc75ea855733b94881953a6b9e8.tar.gz
rust-65c66a15bf99efc75ea855733b94881953a6b9e8.zip
std: fix registering of Windows TLS destructors
-rw-r--r--library/std/src/sys/windows/thread_local_key.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/std/src/sys/windows/thread_local_key.rs b/library/std/src/sys/windows/thread_local_key.rs
index 3c4e1abbba9..831f39817f4 100644
--- a/library/std/src/sys/windows/thread_local_key.rs
+++ b/library/std/src/sys/windows/thread_local_key.rs
@@ -42,7 +42,10 @@ unsafe fn run_keyless_dtors() {
     // the case that this loop always terminates because we provide the
     // guarantee that a TLS key cannot be set after it is flagged for
     // destruction.
-    while let Some((ptr, dtor)) = DESTRUCTORS.borrow_mut().pop() {
+    loop {
+        let Some((ptr, dtor)) = DESTRUCTORS.borrow_mut().pop() else {
+            break;
+        };
         (dtor)(ptr);
     }
     // We're done so free the memory.