Skip to content

Commit b06f139

Browse files
reduce dependencies for windows-msvc (#543)
Some dependencies don't get used on windows-msvc targets, so exclude them: * `miniz_oxide` (+ `adler`) * `addr2line` (+ `gimli`) * `object` (+ `memchr`) * `libc` too Signed-off-by: klensy <[email protected]>
2 parents 3479721 + 56c215e commit b06f139

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ exclude = [
2828
[dependencies]
2929
cfg-if = "1.0"
3030
rustc-demangle = "0.1.4"
31-
libc = { version = "0.2.146", default-features = false }
3231

3332
# Optionally enable the ability to serialize a `Backtrace`, controlled through
3433
# the `serialize-*` features below.
@@ -38,10 +37,12 @@ rustc-serialize = { version = "0.3", optional = true }
3837
# Optionally demangle C++ frames' symbols in backtraces.
3938
cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = ["alloc"] }
4039

41-
addr2line = { version = "0.21.0", default-features = false }
40+
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
4241
miniz_oxide = { version = "0.7.0", default-features = false }
42+
addr2line = { version = "0.21.0", default-features = false }
43+
libc = { version = "0.2.146", default-features = false }
4344

44-
[dependencies.object]
45+
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies.object]
4546
version = "0.32.0"
4647
default-features = false
4748
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']

crates/as-if-std/Cargo.toml

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ bench = false
1515
cfg-if = "1.0"
1616
rustc-demangle = "0.1.21"
1717
libc = { version = "0.2.146", default-features = false }
18-
addr2line = { version = "0.21.0", default-features = false, optional = true }
19-
miniz_oxide = { version = "0.7", default-features = false }
2018

21-
[dependencies.object]
19+
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
20+
miniz_oxide = { version = "0.7.0", optional = true, default-features = false }
21+
addr2line = { version = "0.21.0", optional = true, default-features = false }
22+
23+
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies.object]
2224
version = "0.32.0"
2325
default-features = false
2426
optional = true
@@ -30,4 +32,4 @@ cc = "1.0.67"
3032

3133
[features]
3234
default = ['backtrace']
33-
backtrace = ['addr2line', 'object']
35+
backtrace = ['addr2line', 'miniz_oxide', 'object']

src/symbolize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ cfg_if::cfg_if! {
471471
mod dbghelp;
472472
use dbghelp as imp;
473473
} else if #[cfg(all(
474-
any(unix, windows),
474+
any(unix, all(windows, target_env = "gnu")),
475475
not(target_vendor = "uwp"),
476476
not(target_os = "emscripten"),
477477
any(not(backtrace_in_libstd), feature = "backtrace"),

0 commit comments

Comments
 (0)