about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-08-28 19:12:51 -0700
committerGitHub <noreply@github.com>2024-08-28 19:12:51 -0700
commitfcb6b7792d79a037935757ec4e15bb5a44ff6524 (patch)
tree3328c413dffc9c0af6f1644eaf44a2816897f7d3
parent26f75a65d70773e4520634b9f6599ddf08c499e6 (diff)
parent40481fc70a8626f9e58242b0fb673d90ade2f084 (diff)
downloadrust-fcb6b7792d79a037935757ec4e15bb5a44ff6524.tar.gz
rust-fcb6b7792d79a037935757ec4e15bb5a44ff6524.zip
Rollup merge of #129378 - goffrie:patch-3, r=ChrisDenton
Clean up cfg-gating of ProcessPrng extern

This removes a bit of duplication and is consistent with how `api-ms-win-core-synch-l1-2-0` externs are imported.
-rw-r--r--library/std/src/sys/pal/windows/c.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
index 2f5d75dc4bc..b888eb7d95c 100644
--- a/library/std/src/sys/pal/windows/c.rs
+++ b/library/std/src/sys/pal/windows/c.rs
@@ -109,19 +109,15 @@ if #[cfg(not(target_vendor = "uwp"))] {
 }
 
 // Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
-cfg_if::cfg_if! {
-if #[cfg(not(target_vendor = "win7"))] {
-    #[cfg(target_arch = "x86")]
-    #[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")]
-    extern "system" {
-        pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
-    }
-    #[cfg(not(target_arch = "x86"))]
-    #[link(name = "bcryptprimitives", kind = "raw-dylib")]
-    extern "system" {
-        pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
-    }
-}}
+#[cfg(not(target_vendor = "win7"))]
+#[cfg_attr(
+    target_arch = "x86",
+    link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")
+)]
+#[cfg_attr(not(target_arch = "x86"), link(name = "bcryptprimitives", kind = "raw-dylib"))]
+extern "system" {
+    pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
+}
 
 // Functions that aren't available on every version of Windows that we support,
 // but we still use them and just provide some form of a fallback implementation.