std: always depend on backtrace, but only enable its features on demand
This commit is contained in:
parent
3287a65fc0
commit
b60954757e
9 changed files with 23 additions and 21 deletions
|
@ -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") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue