diff --git a/src/error.rs b/src/error.rs index b9c5688c..b42296ba 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,7 @@ //! Error types use std::{ + backtrace::Backtrace, fmt::{self, Debug, Display}, ops::Deref, }; @@ -59,7 +60,6 @@ where source: Option, /// Backtrace where error occurred - #[cfg(feature = "backtrace")] backtrace: Option, } @@ -72,8 +72,7 @@ where Context { kind, source, - #[cfg(feature = "backtrace")] - backtrace: Some(Backtrace::new()), + backtrace: Some(Backtrace::capture()), } } @@ -83,7 +82,6 @@ where } /// Get the backtrace associated with this error (if available) - #[cfg(feature = "backtrace")] pub fn backtrace(&self) -> Option<&Backtrace> { self.backtrace.as_ref() }