Skip to content

Commit

Permalink
don't let rustc-dep-of-std enable backtrace-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Mar 1, 2020
1 parent 4200442 commit d94848a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude = ['crates/without_debuginfo']
[dependencies]
cfg-if = "0.1.10"
rustc-demangle = "0.1.4"
backtrace-sys = { path = "crates/backtrace-sys", version = "0.1.32", optional = true }
backtrace-sys = { path = "crates/backtrace-sys", version = "0.1.32", optional = true, default_features = false }
libc = { version = "0.2.45", default-features = false }
core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
compiler_builtins = { version = '0.1.2', optional = true }
Expand Down Expand Up @@ -94,7 +94,7 @@ kernel32 = []
# the moment, this is only possible when targetting Linux, since macOS
# splits DWARF out into a separate object file. Enabling this feature
# means one less C dependency.
libbacktrace = ["backtrace-sys"]
libbacktrace = ["backtrace-sys/backtrace-sys"]
dladdr = []
coresymbolication = []
gimli-symbolize = ["addr2line", "findshlibs", "memmap", "goblin"]
Expand Down
4 changes: 4 additions & 0 deletions crates/backtrace-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ compiler_builtins = { version = '0.1.2', optional = true }
cc = "1.0.37"

[features]
default = ["backtrace_sys"]

# Without this feature, this crate does nothing.
backtrace_sys = []
rustc-dep-of-std = ['core', 'compiler_builtins']
3 changes: 2 additions & 1 deletion crates/backtrace-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use std::path::PathBuf;
fn main() {
let target = env::var("TARGET").unwrap();

if target.contains("msvc") || // libbacktrace isn't used on MSVC windows
if !cfg!(feature = "backtrace_sys") || // without this feature, this crate does nothing
target.contains("msvc") || // libbacktrace isn't used on MSVC windows
target.contains("emscripten") || // no way this will ever compile for emscripten
target.contains("cloudabi") ||
target.contains("hermit") ||
Expand Down

0 comments on commit d94848a

Please sign in to comment.