about summary refs log tree commit diff
path: root/library/std/src/sys/thread_local
diff options
context:
space:
mode:
authorThe rustc-josh-sync Cronjob Bot <github-actions@github.com>2025-08-28 04:13:43 +0000
committerThe rustc-josh-sync Cronjob Bot <github-actions@github.com>2025-08-28 04:13:43 +0000
commite36d827a4ef52eb0db1b8be7e6972a65730b392b (patch)
tree33ef7d92c09234e6a3928476d1954e528c327a10 /library/std/src/sys/thread_local
parent202eb0b375d1e5cfcf19a51f5a6b40d34d5fc0d1 (diff)
parentd36f964125163c2e698de5559efefb8217b8b7f0 (diff)
downloadrust-e36d827a4ef52eb0db1b8be7e6972a65730b392b.tar.gz
rust-e36d827a4ef52eb0db1b8be7e6972a65730b392b.zip
Merge ref 'd36f96412516' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: d36f964125163c2e698de5559efefb8217b8b7f0
Filtered ref: 92461731ae79cfe5044e4826160665b77c0363a2

This merge was created using https://github.com/rust-lang/josh-sync.
Diffstat (limited to 'library/std/src/sys/thread_local')
-rw-r--r--library/std/src/sys/thread_local/mod.rs60
1 files changed, 36 insertions, 24 deletions
diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs
index 9fafac3aa5b..cff74857c47 100644
--- a/library/std/src/sys/thread_local/mod.rs
+++ b/library/std/src/sys/thread_local/mod.rs
@@ -23,21 +23,23 @@
     issue = "none"
 )]
 
-cfg_if::cfg_if! {
-    if #[cfg(any(
+cfg_select! {
+    any(
         all(target_family = "wasm", not(target_feature = "atomics")),
         target_os = "uefi",
         target_os = "zkvm",
         target_os = "trusty",
-    ))] {
+    ) => {
         mod no_threads;
         pub use no_threads::{EagerStorage, LazyStorage, thread_local_inner};
         pub(crate) use no_threads::{LocalPointer, local_pointer};
-    } else if #[cfg(target_thread_local)] {
+    }
+    target_thread_local => {
         mod native;
         pub use native::{EagerStorage, LazyStorage, thread_local_inner};
         pub(crate) use native::{LocalPointer, local_pointer};
-    } else {
+    }
+    _ => {
         mod os;
         pub use os::{Storage, thread_local_inner};
         pub(crate) use os::{LocalPointer, local_pointer};
@@ -53,8 +55,8 @@ cfg_if::cfg_if! {
 /// single callback that runs all of the destructors in the list.
 #[cfg(all(target_thread_local, not(all(target_family = "wasm", not(target_feature = "atomics")))))]
 pub(crate) mod destructors {
-    cfg_if::cfg_if! {
-        if #[cfg(any(
+    cfg_select! {
+        any(
             target_os = "linux",
             target_os = "android",
             target_os = "fuchsia",
@@ -62,12 +64,13 @@ pub(crate) mod destructors {
             target_os = "hurd",
             target_os = "netbsd",
             target_os = "dragonfly"
-        ))] {
+        ) => {
             mod linux_like;
             mod list;
             pub(super) use linux_like::register;
             pub(super) use list::run;
-        } else {
+        }
+        _ => {
             mod list;
             pub(super) use list::register;
             pub(crate) use list::run;
@@ -79,21 +82,23 @@ pub(crate) mod destructors {
 /// and the [runtime cleanup](crate::rt::thread_cleanup) function. Calling `enable`
 /// should ensure that these functions are called at the right times.
 pub(crate) mod guard {
-    cfg_if::cfg_if! {
-        if #[cfg(all(target_thread_local, target_vendor = "apple"))] {
+    cfg_select! {
+        all(target_thread_local, target_vendor = "apple") => {
             mod apple;
             pub(crate) use apple::enable;
-        } else if #[cfg(target_os = "windows")] {
+        }
+        target_os = "windows" => {
             mod windows;
             pub(crate) use windows::enable;
-        } else if #[cfg(any(
+        }
+        any(
             all(target_family = "wasm", not(
                 all(target_os = "wasi", target_env = "p1", target_feature = "atomics")
             )),
             target_os = "uefi",
             target_os = "zkvm",
             target_os = "trusty",
-        ))] {
+        ) => {
             pub(crate) fn enable() {
                 // FIXME: Right now there is no concept of "thread exit" on
                 // wasm, but this is likely going to show up at some point in
@@ -107,17 +112,20 @@ pub(crate) mod guard {
                 #[allow(unused)]
                 use crate::rt::thread_cleanup;
             }
-        } else if #[cfg(any(
+        }
+        any(
             target_os = "hermit",
             target_os = "xous",
-        ))] {
+        ) => {
             // `std` is the only runtime, so it just calls the destructor functions
             // itself when the time comes.
             pub(crate) fn enable() {}
-        } else if #[cfg(target_os = "solid_asp3")] {
+        }
+        target_os = "solid_asp3" => {
             mod solid;
             pub(crate) use solid::enable;
-        } else {
+        }
+        _ => {
             mod key;
             pub(crate) use key::enable;
         }
@@ -131,8 +139,8 @@ pub(crate) mod guard {
 /// reference an entry in a thread-local table. This then associates each key
 /// with a pointer which we can get and set to store our data.
 pub(crate) mod key {
-    cfg_if::cfg_if! {
-        if #[cfg(any(
+    cfg_select! {
+        any(
             all(
                 not(target_vendor = "apple"),
                 not(target_family = "wasm"),
@@ -141,7 +149,7 @@ pub(crate) mod key {
             all(not(target_thread_local), target_vendor = "apple"),
             target_os = "teeos",
             all(target_os = "wasi", target_env = "p1", target_feature = "atomics"),
-        ))] {
+        ) => {
             mod racy;
             mod unix;
             #[cfg(test)]
@@ -151,12 +159,14 @@ pub(crate) mod key {
             #[cfg(any(not(target_thread_local), test))]
             pub(super) use unix::get;
             use unix::{create, destroy};
-        } else if #[cfg(all(not(target_thread_local), target_os = "windows"))] {
+        }
+        all(not(target_thread_local), target_os = "windows") => {
             #[cfg(test)]
             mod tests;
             mod windows;
             pub(super) use windows::{Key, LazyKey, get, run_dtors, set};
-        } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
+        }
+        all(target_vendor = "fortanix", target_env = "sgx") => {
             mod racy;
             mod sgx;
             #[cfg(test)]
@@ -164,7 +174,8 @@ pub(crate) mod key {
             pub(super) use racy::LazyKey;
             pub(super) use sgx::{Key, get, set};
             use sgx::{create, destroy};
-        } else if #[cfg(target_os = "xous")] {
+        }
+        target_os = "xous" => {
             mod racy;
             #[cfg(test)]
             mod tests;
@@ -174,6 +185,7 @@ pub(crate) mod key {
             pub(super) use xous::{Key, get, set};
             use xous::{create, destroy};
         }
+        _ => {}
     }
 }