Further simply backtrace conditional compilation · dtolnay/anyhow@7fe62b5 (original) (raw)

Commit 7fe62b5

Further simply backtrace conditional compilation

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

Lines changed: 2 additions & 2 deletions

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
1 1 #[cfg(feature = "std")]
2 -pub(crate) use std::backtrace::{Backtrace, BacktraceStatus};
2 +pub(crate) use std::backtrace::Backtrace;
3 3
4 4 #[cfg(not(feature = "std"))]
5 5 pub(crate) enum Backtrace {}
6 6
7 7 #[cfg(feature = "std")]
8 8 macro_rules! backtrace {
9 9 () => {
10 -Some(crate::backtrace::Backtrace::capture())
10 +Some(std::backtrace::Backtrace::capture())
11 11 };
12 12 }
13 13

Lines changed: 1 addition & 1 deletion

Original file line number Diff line number Diff line change
@@ -411,7 +411,7 @@ impl Error {
411 411 /// anyhow = { version = "1.0", features = ["backtrace"] }
412 412 /// ```
413 413 #[cfg(feature = "std")]
414 -pub fn backtrace(&self) -> &std::backtrace::Backtrace {
414 +pub fn backtrace(&self) -> &Backtrace {
415 415 unsafe { ErrorImpl::backtrace(self.inner.by_ref()) }
416 416 }
417 417

Lines changed: 1 addition & 1 deletion

Original file line number Diff line number Diff line change
@@ -42,8 +42,8 @@ impl ErrorImpl {
42 42
43 43 #[cfg(feature = "std")]
44 44 {
45 -use crate::backtrace::BacktraceStatus;
46 45 use alloc:🧵:ToString;
46 +use std::backtrace::BacktraceStatus;
47 47
48 48 let backtrace = unsafe { Self::backtrace(this) };
49 49 if let BacktraceStatus::Captured = backtrace.status() {

0 commit comments