Skip to content

Commit 010ec4e

Browse files
committed
Auto merge of #113432 - klensy:ms-cut-backtrace, r=ChrisDenton
reduce deps for windows-msvc targets for backtrace (eventually) mirrors rust-lang/backtrace-rs#543 Some dependencies of backtrace don't used on windows-msvc targets, so exclude them: miniz_oxide (+ adler) addr2line (+ gimli) object (+ memchr) This saves about 30kb of std.dll + 17.5mb of rlibs
2 parents cabb6af + 25ef2bc commit 010ec4e

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

std/Cargo.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ hashbrown = { version = "0.14", default-features = false, features = ['rustc-dep
2525
std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = ['rustc-dep-of-std'] }
2626

2727
# Dependencies of the `backtrace` crate
28-
addr2line = { version = "0.20.0", optional = true, default-features = false }
2928
rustc-demangle = { version = "0.1.21", features = ['rustc-dep-of-std'] }
30-
miniz_oxide = { version = "0.7.0", optional = true, default-features = false, public = false }
31-
[dependencies.object]
32-
version = "0.31.1"
33-
optional = true
34-
default-features = false
35-
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
29+
30+
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
31+
miniz_oxide = { version = "0.7.0", optional = true, default-features = false }
32+
addr2line = { version = "0.20.0", optional = true, default-features = false }
33+
object = { version = "0.31.1", default-features = false, optional = true, features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive'] }
3634

3735
[dev-dependencies]
3836
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }

std/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,15 @@ extern crate libc;
397397
#[allow(unused_extern_crates)]
398398
extern crate unwind;
399399

400+
// FIXME: #94122 this extern crate definition only exist here to stop
401+
// miniz_oxide docs leaking into std docs. Find better way to do it.
402+
// Remove exclusion from tidy platform check when this removed.
400403
#[doc(masked)]
401404
#[allow(unused_extern_crates)]
402-
#[cfg(feature = "miniz_oxide")]
405+
#[cfg(all(
406+
not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))),
407+
feature = "miniz_oxide"
408+
))]
403409
extern crate miniz_oxide;
404410

405411
// During testing, this crate is not actually the "real" std library, but rather

0 commit comments

Comments
 (0)