Add windows-targets crate to std's sysroot · patricklam/verify-rust-std@a3a6a98 (original) (raw)

7 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -57,6 +57,9 @@ object = { version = "0.36.0", default-features = false, optional = true, featur
57 57 'archive',
58 58 ] }
59 59
60 +[target.'cfg(windows)'.dependencies.windows-targets]
61 +path = "../windows_targets"
62 +
60 63 [dev-dependencies]
61 64 rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
62 65 rand_xorshift = "0.3.0"
@@ -116,7 +119,7 @@ std_detect_env_override = ["std_detect/std_detect_env_override"]
116 119
117 120 # Enable using raw-dylib for Windows imports.
118 121 # This will eventually be the default.
119 -windows_raw_dylib = []
122 +windows_raw_dylib = ["windows-targets/windows_raw_dylib"]
120 123
121 124 [package.metadata.fortanix-sgx]
122 125 # Maximum possible number of threads when testing
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ use crate::alloc::{GlobalAlloc, Layout, System};
4 4 use crate::ffi::c_void;
5 5 use crate::ptr;
6 6 use crate::sync::atomic::{AtomicPtr, Ordering};
7 -use crate::sys::c::{self, windows_targets};
7 +use crate::sys::c;
8 8 use crate::sys::common::alloc::{realloc_fallback, MIN_ALIGN};
9 9
10 10 #[cfg(test)]
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@
8 8 use core::ffi::{c_uint, c_ulong, c_ushort, c_void, CStr};
9 9 use core::{mem, ptr};
10 10
11 -pub(super) mod windows_targets;
12 -
13 11 mod windows_sys;
14 12 pub use windows_sys::*;
15 13
Original file line number Diff line number Diff line change
@@ -3317,4 +3317,3 @@ pub struct WSADATA {
3317 3317 #[cfg(target_arch = "arm")]
3318 3318 pub enum CONTEXT {}
3319 3319 // ignore-tidy-filelength
3320 -use super::windows_targets;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1 +[package]
2 +name = "windows-targets"
3 +description = "A drop-in replacement for the real windows-targets crate for use in std only."
4 +version = "0.0.0"
5 +edition = "2021"
6 +
7 +[features]
8 +# Enable using raw-dylib for Windows imports.
9 +# This will eventually be the default.
10 +windows_raw_dylib = []
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
2 2 //!
3 3 //! This is a simple wrapper around an `extern` block with a `#[link]` attribute.
4 4 //! It's very roughly equivalent to the windows-targets crate.
5 +#![no_std]
6 +#![no_core]
7 +#![feature(decl_macro)]
8 +#![feature(no_core)]
5 9
6 10 #[cfg(feature = "windows_raw_dylib")]
7 11 pub macro link {