Skip to content
/ rust Public
forked from rust-lang/rust

Commit 08691f0

Browse files
committed
Auto merge of rust-lang#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 4d7a80d + 8238361 commit 08691f0

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

library/std/Cargo.toml

+5-7
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"] }

library/std/src/lib.rs

+7-1
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

src/tools/tidy/src/deps.rs

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ const PERMITTED_DEPS_LOCATION: &str = concat!(file!(), ":", line!());
113113
/// rustc. Please check with the compiler team before adding an entry.
114114
const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
115115
// tidy-alphabetical-start
116-
"addr2line",
117116
"adler",
118117
"ahash",
119118
"aho-corasick",

src/tools/tidy/src/pal.rs

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const EXCEPTION_PATHS: &[&str] = &[
5252
// FIXME: platform-specific code should be moved to `sys`
5353
"library/std/src/io/copy.rs",
5454
"library/std/src/io/stdio.rs",
55+
"library/std/src/lib.rs", // for miniz_oxide leaking docs, which itself workaround
5556
"library/std/src/path.rs",
5657
"library/std/src/sys_common", // Should only contain abstractions over platforms
5758
"library/std/src/net/test.rs", // Utility helpers for tests

0 commit comments

Comments
 (0)