Skip to content

Commit cd59153

Browse files
Rollup merge of rust-lang#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.
2 parents 6d31b6d + b51f35e commit cd59153

File tree

1 file changed

+9
-13
lines changed
  • std/src/sys/pal/windows

1 file changed

+9
-13
lines changed

Diff for: std/src/sys/pal/windows/c.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,15 @@ if #[cfg(not(target_vendor = "uwp"))] {
109109
}
110110

111111
// Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
112-
cfg_if::cfg_if! {
113-
if #[cfg(not(target_vendor = "win7"))] {
114-
#[cfg(target_arch = "x86")]
115-
#[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")]
116-
extern "system" {
117-
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
118-
}
119-
#[cfg(not(target_arch = "x86"))]
120-
#[link(name = "bcryptprimitives", kind = "raw-dylib")]
121-
extern "system" {
122-
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
123-
}
124-
}}
112+
#[cfg(not(target_vendor = "win7"))]
113+
#[cfg_attr(
114+
target_arch = "x86",
115+
link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")
116+
)]
117+
#[cfg_attr(not(target_arch = "x86"), link(name = "bcryptprimitives", kind = "raw-dylib"))]
118+
extern "system" {
119+
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
120+
}
125121

126122
// Functions that aren't available on every version of Windows that we support,
127123
// but we still use them and just provide some form of a fallback implementation.

0 commit comments

Comments
 (0)