diff --git a/library/Cargo.lock b/library/Cargo.lock index ff859e9ffc0c..9a80a930e36e 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -347,7 +347,7 @@ dependencies = [ "wasip1", "wasip2", "wasip3", - "windows-link 0.0.0", + "windows-link", ] [[package]] @@ -443,20 +443,9 @@ dependencies = [ name = "windows-link" version = "0.0.0" -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - [[package]] name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link 0.2.1", -] +version = "0.61.100" [[package]] name = "wit-bindgen" diff --git a/library/Cargo.toml b/library/Cargo.toml index 87df966bb6b8..788c990c1634 100644 --- a/library/Cargo.toml +++ b/library/Cargo.toml @@ -85,3 +85,6 @@ rustflags = [ rustc-std-workspace-core = { path = 'rustc-std-workspace-core' } rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' } rustc-std-workspace-std = { path = 'rustc-std-workspace-std' } + +# See comments in `library/windows-sys/Cargo.toml` for why this is patched +windows-sys = { path = 'windows-sys' } diff --git a/library/windows-sys/Cargo.toml b/library/windows-sys/Cargo.toml new file mode 100644 index 000000000000..eb27eff15e84 --- /dev/null +++ b/library/windows-sys/Cargo.toml @@ -0,0 +1,16 @@ +# dlmalloc has a dependency on windows-sys for when it gets compiled for Windows. +# std however never actually uses dlmalloc on Windows. As dlmalloc is the only +# user of windows-sys in the standard library, the windows-sys crate unnecessarily +# increases the size of the vendored crates. By replacing it with an empty crate +# we save about 19MB. + +[package] +name = "windows-sys" +version = "0.61.100" +edition = "2024" + +[features] +Win32_Foundation = [] +Win32_System_Memory = [] +Win32_System_Threading = [] +Win32_System_SystemInformation = [] diff --git a/library/windows-sys/src/lib.rs b/library/windows-sys/src/lib.rs new file mode 100644 index 000000000000..112740ab2d1b --- /dev/null +++ b/library/windows-sys/src/lib.rs @@ -0,0 +1 @@ +compile_error!("This crate should never be compiled"); diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index ec21e2669523..7c3315127989 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -543,7 +543,7 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[ "wasip2", "wasip3", "windows-link", - "windows-sys", + "windows-sys@0.61.100", // Enforce the usage of our dummy windows-sys patch. Keep version in sync. "wit-bindgen", // tidy-alphabetical-end ];