about summary refs log tree commit diff
path: root/library/std/src/sys/env
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2025-08-20 05:01:50 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2025-08-20 05:01:50 +0000
commit8d09fb5e6d330b2e32bb98b89fb8a3fadd2bfd48 (patch)
tree8b927cdee8253f3df663c2931a1c6bc8fc980eb2 /library/std/src/sys/env
parent49329f0d8a2a79e363150f9b40778a0751ba22e8 (diff)
parentf605b57042ffeb320d7ae44490113a827139b766 (diff)
downloadrust-8d09fb5e6d330b2e32bb98b89fb8a3fadd2bfd48.tar.gz
rust-8d09fb5e6d330b2e32bb98b89fb8a3fadd2bfd48.zip
Merge ref 'f605b57042ff' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: f605b57042ffeb320d7ae44490113a827139b766
Filtered ref: c69d2743ed4676c4529ebb60b258f6c1273c9145

This merge was created using https://github.com/rust-lang/josh-sync.
Diffstat (limited to 'library/std/src/sys/env')
-rw-r--r--library/std/src/sys/env/mod.rs31
-rw-r--r--library/std/src/sys/env/wasi.rs7
2 files changed, 24 insertions, 14 deletions
diff --git a/library/std/src/sys/env/mod.rs b/library/std/src/sys/env/mod.rs
index d81ff875c83..f211a9fc86b 100644
--- a/library/std/src/sys/env/mod.rs
+++ b/library/std/src/sys/env/mod.rs
@@ -13,35 +13,44 @@
 ))]
 mod common;
 
-cfg_if::cfg_if! {
-    if #[cfg(target_family = "unix")] {
+cfg_select! {
+    target_family = "unix" => {
         mod unix;
         pub use unix::*;
-    } else if #[cfg(target_family = "windows")] {
+    }
+    target_family = "windows" => {
         mod windows;
         pub use windows::*;
-    } else if #[cfg(target_os = "hermit")] {
+    }
+    target_os = "hermit" => {
         mod hermit;
         pub use hermit::*;
-    } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
+    }
+    all(target_vendor = "fortanix", target_env = "sgx") => {
         mod sgx;
         pub use sgx::*;
-    } else if #[cfg(target_os = "solid_asp3")] {
+    }
+    target_os = "solid_asp3" => {
         mod solid;
         pub use solid::*;
-    } else if #[cfg(target_os = "uefi")] {
+    }
+    target_os = "uefi" => {
         mod uefi;
         pub use uefi::*;
-    } else if #[cfg(target_os = "wasi")] {
+    }
+    target_os = "wasi" => {
         mod wasi;
         pub use wasi::*;
-    } else if #[cfg(target_os = "xous")] {
+    }
+    target_os = "xous" => {
         mod xous;
         pub use xous::*;
-    } else if #[cfg(target_os = "zkvm")] {
+    }
+    target_os = "zkvm" => {
         mod zkvm;
         pub use zkvm::*;
-    } else {
+    }
+    _ => {
         mod unsupported;
         pub use unsupported::*;
     }
diff --git a/library/std/src/sys/env/wasi.rs b/library/std/src/sys/env/wasi.rs
index 3719f9db51e..1327cbc3263 100644
--- a/library/std/src/sys/env/wasi.rs
+++ b/library/std/src/sys/env/wasi.rs
@@ -7,8 +7,8 @@ use crate::os::wasi::prelude::*;
 use crate::sys::common::small_c_string::run_with_cstr;
 use crate::sys::pal::os::{cvt, libc};
 
-cfg_if::cfg_if! {
-    if #[cfg(target_feature = "atomics")] {
+cfg_select! {
+    target_feature = "atomics" => {
         // Access to the environment must be protected by a lock in multi-threaded scenarios.
         use crate::sync::{PoisonError, RwLock};
         static ENV_LOCK: RwLock<()> = RwLock::new(());
@@ -18,7 +18,8 @@ cfg_if::cfg_if! {
         pub fn env_write_lock() -> impl Drop {
             ENV_LOCK.write().unwrap_or_else(PoisonError::into_inner)
         }
-    } else {
+    }
+    _ => {
         // No need for a lock if we are single-threaded.
         pub fn env_read_lock() -> impl Drop {
             Box::new(())