diff options
| author | Ralf Jung <post@ralfj.de> | 2019-09-14 10:23:10 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-09-14 10:23:51 +0200 |
| commit | b60954757eb1acd4069ddbc28a51f4a5bb7d42c9 (patch) | |
| tree | deda1c332a73e20c428ae5ea31893ff7d110136c /src/libstd/sys_common | |
| parent | 3287a65fc05028dce3b521765f4643384ebc4346 (diff) | |
| download | rust-b60954757eb1acd4069ddbc28a51f4a5bb7d42c9.tar.gz rust-b60954757eb1acd4069ddbc28a51f4a5bb7d42c9.zip | |
std: always depend on backtrace, but only enable its features on demand
Diffstat (limited to 'src/libstd/sys_common')
| -rw-r--r-- | src/libstd/sys_common/backtrace.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys_common/mod.rs | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 1a78abf5086..52890668c35 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -7,7 +7,6 @@ use crate::io; use crate::borrow::Cow; use crate::io::prelude::*; use crate::path::{self, Path, PathBuf}; -use crate::sync::atomic::{self, Ordering}; use crate::sys::mutex::Mutex; use backtrace::{BacktraceFmt, BytesOrWideString, PrintFmt}; @@ -34,6 +33,7 @@ pub fn lock() -> impl Drop { } /// Prints the current backtrace. +#[cfg(feature = "backtrace_support")] pub fn print(w: &mut dyn Write, format: PrintFmt) -> io::Result<()> { // There are issues currently linking libbacktrace into tests, and in // general during libstd's own unit tests we're not testing this path. In @@ -129,7 +129,10 @@ where // For now logging is turned off by default, and this function checks to see // whether the magical environment variable is present to see if it's turned on. +#[cfg(feature = "backtrace_support")] pub fn log_enabled() -> Option<PrintFmt> { + use crate::sync::atomic::{self, Ordering}; + // Setting environment variables for Fuchsia components isn't a standard // or easily supported workflow. For now, always display backtraces. if cfg!(target_os = "fuchsia") { diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 9190a3b0d5f..cba3eca5386 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -41,7 +41,6 @@ macro_rules! rtunwrap { pub mod alloc; pub mod at_exit_imp; -#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod io; |
