Skip to content

Commit 83adf7e

Browse files
committed
Auto merge of #155681 - bjorn3:update_dlmalloc, r=clubby789
Remove windows-sys from the library workspace Windows-sys isn't actually used as dlmalloc doesn't use it on any of the targets where std uses dlmalloc, but still ends up in the lockfile and thus gets vendored. By using a patch to replace it with an empty crate the vendor size of the standard library is reduced from 93MB to 20MB.
2 parents cb40c25 + b7f337e commit 83adf7e

5 files changed

Lines changed: 25 additions & 90 deletions

File tree

library/Cargo.lock

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ dependencies = [
7878

7979
[[package]]
8080
name = "dlmalloc"
81-
version = "0.2.11"
81+
version = "0.2.13"
8282
source = "registry+https://github.com/rust-lang/crates.io-index"
83-
checksum = "06cdfe340b16dd990c54cce79743613fa09fbb16774f33a77c9fd196f8f3fa30"
83+
checksum = "9f5b01c17f85ee988d832c40e549a64bd89ab2c9f8d8a613bdf5122ae507e294"
8484
dependencies = [
8585
"cfg-if",
8686
"libc",
@@ -347,7 +347,7 @@ dependencies = [
347347
"wasip1",
348348
"wasip2",
349349
"wasip3",
350-
"windows-link 0.0.0",
350+
"windows-link",
351351
]
352352

353353
[[package]]
@@ -443,85 +443,9 @@ dependencies = [
443443
name = "windows-link"
444444
version = "0.0.0"
445445

446-
[[package]]
447-
name = "windows-link"
448-
version = "0.2.1"
449-
source = "registry+https://github.com/rust-lang/crates.io-index"
450-
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
451-
452446
[[package]]
453447
name = "windows-sys"
454-
version = "0.60.2"
455-
source = "registry+https://github.com/rust-lang/crates.io-index"
456-
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
457-
dependencies = [
458-
"windows-targets",
459-
]
460-
461-
[[package]]
462-
name = "windows-targets"
463-
version = "0.53.5"
464-
source = "registry+https://github.com/rust-lang/crates.io-index"
465-
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
466-
dependencies = [
467-
"windows-link 0.2.1",
468-
"windows_aarch64_gnullvm",
469-
"windows_aarch64_msvc",
470-
"windows_i686_gnu",
471-
"windows_i686_gnullvm",
472-
"windows_i686_msvc",
473-
"windows_x86_64_gnu",
474-
"windows_x86_64_gnullvm",
475-
"windows_x86_64_msvc",
476-
]
477-
478-
[[package]]
479-
name = "windows_aarch64_gnullvm"
480-
version = "0.53.1"
481-
source = "registry+https://github.com/rust-lang/crates.io-index"
482-
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
483-
484-
[[package]]
485-
name = "windows_aarch64_msvc"
486-
version = "0.53.1"
487-
source = "registry+https://github.com/rust-lang/crates.io-index"
488-
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
489-
490-
[[package]]
491-
name = "windows_i686_gnu"
492-
version = "0.53.1"
493-
source = "registry+https://github.com/rust-lang/crates.io-index"
494-
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
495-
496-
[[package]]
497-
name = "windows_i686_gnullvm"
498-
version = "0.53.1"
499-
source = "registry+https://github.com/rust-lang/crates.io-index"
500-
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
501-
502-
[[package]]
503-
name = "windows_i686_msvc"
504-
version = "0.53.1"
505-
source = "registry+https://github.com/rust-lang/crates.io-index"
506-
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
507-
508-
[[package]]
509-
name = "windows_x86_64_gnu"
510-
version = "0.53.1"
511-
source = "registry+https://github.com/rust-lang/crates.io-index"
512-
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
513-
514-
[[package]]
515-
name = "windows_x86_64_gnullvm"
516-
version = "0.53.1"
517-
source = "registry+https://github.com/rust-lang/crates.io-index"
518-
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
519-
520-
[[package]]
521-
name = "windows_x86_64_msvc"
522-
version = "0.53.1"
523-
source = "registry+https://github.com/rust-lang/crates.io-index"
524-
checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
448+
version = "0.61.100"
525449

526450
[[package]]
527451
name = "wit-bindgen"

library/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,6 @@ rustflags = [
8585
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
8686
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
8787
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
88+
89+
# See comments in `library/windows-sys/Cargo.toml` for why this is patched
90+
windows-sys = { path = 'windows-sys' }

library/windows-sys/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# dlmalloc has a dependency on windows-sys for when it gets compiled for Windows.
2+
# std however never actually uses dlmalloc on Windows. As dlmalloc is the only
3+
# user of windows-sys in the standard library, the windows-sys crate unnecessarily
4+
# increases the size of the vendored crates. By replacing it with an empty crate
5+
# we save about 19MB.
6+
7+
[package]
8+
name = "windows-sys"
9+
version = "0.61.100"
10+
edition = "2024"
11+
12+
[features]
13+
Win32_Foundation = []
14+
Win32_System_Memory = []
15+
Win32_System_Threading = []
16+
Win32_System_SystemInformation = []

library/windows-sys/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
compile_error!("This crate should never be compiled");

src/tools/tidy/src/deps.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -543,16 +543,7 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[
543543
"wasip2",
544544
"wasip3",
545545
"windows-link",
546-
"windows-sys",
547-
"windows-targets",
548-
"windows_aarch64_gnullvm",
549-
"windows_aarch64_msvc",
550-
"windows_i686_gnu",
551-
"windows_i686_gnullvm",
552-
"windows_i686_msvc",
553-
"windows_x86_64_gnu",
554-
"windows_x86_64_gnullvm",
555-
"windows_x86_64_msvc",
546+
"windows-sys@0.61.100", // Enforce the usage of our dummy windows-sys patch. Keep version in sync.
556547
"wit-bindgen",
557548
// tidy-alphabetical-end
558549
];

0 commit comments

Comments
 (0)