Skip to content

Commit 68336fe

Browse files
committed
Auto merge of #126913 - ChrisDenton:win-sys, r=<try>
[EXPERIMENT]: Use Windows `sys` bindings and add raw-dylib feature With recent changes in win32metadata and windows-rs we should no longer need a special `-std` bindings. Additionally, this adds a `windows-raw-dylib` feature that allows users of `build-std` to experiment with using `raw-dylib`. The feature isn't yet complete because there are a few other crates that contribute imports (alloc and backtrace). This PR will currently fail CI's tidy test due to using a git dependency. cc `@kennykerr,` just to notify you I'm experimenting with this try-job: x86_64-msvc try-job: i686-msvc try-job: i686-mingw try-job: x86_64-mingw r? ghost
2 parents a299aa5 + a07cc33 commit 68336fe

File tree

11 files changed

+174
-850
lines changed

11 files changed

+174
-850
lines changed

Cargo.lock

+2-4
Original file line numberDiff line numberDiff line change
@@ -6324,8 +6324,7 @@ dependencies = [
63246324
[[package]]
63256325
name = "windows-bindgen"
63266326
version = "0.57.0"
6327-
source = "registry+https://github.com/rust-lang/crates.io-index"
6328-
checksum = "1ccb96113d6277ba543c0f77e1c5494af8094bf9daf9b85acdc3f1b620e7c7b4"
6327+
source = "git+https://github.com/microsoft/windows-rs.git#863a7cf1d05096c09f2c7cac13ff9f5c9abec61e"
63296328
dependencies = [
63306329
"proc-macro2",
63316330
"rayon",
@@ -6347,8 +6346,7 @@ dependencies = [
63476346
[[package]]
63486347
name = "windows-metadata"
63496348
version = "0.57.0"
6350-
source = "registry+https://github.com/rust-lang/crates.io-index"
6351-
checksum = "8308d076825b9d9e5abc64f8113e96d02b2aeeba869b20fdd65c7e70cda13dfc"
6349+
source = "git+https://github.com/microsoft/windows-rs.git#863a7cf1d05096c09f2c7cac13ff9f5c9abec61e"
63526350

63536351
[[package]]
63546352
name = "windows-sys"

library/std/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ std_detect_file_io = ["std_detect/std_detect_file_io"]
8787
std_detect_dlsym_getauxval = ["std_detect/std_detect_dlsym_getauxval"]
8888
std_detect_env_override = ["std_detect/std_detect_env_override"]
8989

90+
# Enable using raw-dylib for Windows imports.
91+
# This will eventually be the default.
92+
windows_raw_dylib = []
93+
9094
[package.metadata.fortanix-sgx]
9195
# Maximum possible number of threads when testing
9296
threads = 125

library/std/src/sys/pal/windows/c.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_vo
1313
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
1414
use crate::ptr;
1515

16+
mod windows_targets;
17+
1618
mod windows_sys;
1719
pub use windows_sys::*;
1820

@@ -504,7 +506,7 @@ if #[cfg(not(target_vendor = "uwp"))] {
504506
#[cfg(target_arch = "arm")]
505507
pub enum CONTEXT {}
506508
}}
507-
509+
// WSAStartup is only redefined here so that we can override WSADATA for Arm32
508510
#[link(name = "ws2_32")]
509511
extern "system" {
510512
pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32;

library/std/src/sys/pal/windows/c/bindings.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--out windows_sys.rs
2-
--config flatten std
2+
--config flatten sys
33
--filter
44
!Windows.Win32.Foundation.INVALID_HANDLE_VALUE
55
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED

0 commit comments

Comments
 (0)