From 0b37a22a0932387e99fcee40e9346383addd49c9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 1 Mar 2020 12:13:25 +0100 Subject: [PATCH] don't let rustc-dep-of-std enable backtrace-sys --- Cargo.toml | 4 ++-- crates/backtrace-sys/Cargo.toml | 4 ++++ crates/backtrace-sys/build.rs | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1f32d5e63..98559d49f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } @@ -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"] diff --git a/crates/backtrace-sys/Cargo.toml b/crates/backtrace-sys/Cargo.toml index 5245d6b1f..935cdffdb 100644 --- a/crates/backtrace-sys/Cargo.toml +++ b/crates/backtrace-sys/Cargo.toml @@ -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'] diff --git a/crates/backtrace-sys/build.rs b/crates/backtrace-sys/build.rs index 98ab6be05..5b49cd4a4 100644 --- a/crates/backtrace-sys/build.rs +++ b/crates/backtrace-sys/build.rs @@ -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") ||