Skip to content

Commit

Permalink
reduce dependencies for windows-msvc (#543)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
workingjubilee authored Aug 18, 2023
2 parents 3479721 + 56c215e commit b06f139
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ exclude = [
[dependencies]
cfg-if = "1.0"
rustc-demangle = "0.1.4"
libc = { version = "0.2.146", default-features = false }

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

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

[dependencies.object]
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies.object]
version = "0.32.0"
default-features = false
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
Expand Down
10 changes: 6 additions & 4 deletions crates/as-if-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ bench = false
cfg-if = "1.0"
rustc-demangle = "0.1.21"
libc = { version = "0.2.146", default-features = false }
addr2line = { version = "0.21.0", default-features = false, optional = true }
miniz_oxide = { version = "0.7", default-features = false }

[dependencies.object]
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
miniz_oxide = { version = "0.7.0", optional = true, default-features = false }
addr2line = { version = "0.21.0", optional = true, default-features = false }

[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies.object]
version = "0.32.0"
default-features = false
optional = true
Expand All @@ -30,4 +32,4 @@ cc = "1.0.67"

[features]
default = ['backtrace']
backtrace = ['addr2line', 'object']
backtrace = ['addr2line', 'miniz_oxide', 'object']
2 changes: 1 addition & 1 deletion src/symbolize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ cfg_if::cfg_if! {
mod dbghelp;
use dbghelp as imp;
} else if #[cfg(all(
any(unix, windows),
any(unix, all(windows, target_env = "gnu")),
not(target_vendor = "uwp"),
not(target_os = "emscripten"),
any(not(backtrace_in_libstd), feature = "backtrace"),
Expand Down

0 comments on commit b06f139

Please sign in to comment.