diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-16 17:09:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-16 17:09:37 +0200 |
| commit | 2a6a342aafdbd407b41cd886a6ae33a025cd27ab (patch) | |
| tree | b80af3e11ba02f0ad80ddf321673c5c5ffb642ee /src/libstd/sys_common/backtrace.rs | |
| parent | 63bc6aeb7d57fc585c67ea8b96a03802d3570b42 (diff) | |
| parent | 49854c4f71eb8470c2a4483cbad3f03eb99e67cb (diff) | |
Rollup merge of #64444 - RalfJung:no-backtrace, r=alexcrichton
fix building libstd without backtrace feature Fixes https://github.com/rust-lang/rust/issues/64410 r? @alexcrichton
Diffstat (limited to 'src/libstd/sys_common/backtrace.rs')
| -rw-r--r-- | src/libstd/sys_common/backtrace.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 1a78abf5086..01711d415d8 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -7,10 +7,9 @@ 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}; +use backtrace_rs::{BacktraceFmt, BytesOrWideString, PrintFmt}; /// Max number of frames to print. const MAX_NB_FRAMES: usize = 100; @@ -74,14 +73,14 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: bt_fmt.add_context()?; let mut idx = 0; let mut res = Ok(()); - backtrace::trace_unsynchronized(|frame| { + backtrace_rs::trace_unsynchronized(|frame| { if print_fmt == PrintFmt::Short && idx > MAX_NB_FRAMES { return false; } let mut hit = false; let mut stop = false; - backtrace::resolve_frame_unsynchronized(frame, |symbol| { + backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| { hit = true; if print_fmt == PrintFmt::Short { if let Some(sym) = symbol.name().and_then(|s| s.as_str()) { @@ -130,6 +129,8 @@ 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. 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") { |
