Skip to content

Commit b6ac995

Browse files
committed
Touch up PR 293
1 parent 684c231 commit b6ac995

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ default = ["std"]
1616
std = []
1717

1818
[dependencies]
19+
# On compilers older than 1.65, features=["backtrace"] may be used to enable
20+
# backtraces via the `backtrace` crate. This feature has no effect on 1.65+
21+
# besides bringing in an unused dependency, as `std::backtrace` is always
22+
# preferred.
1923
backtrace = { version = "0.3.51", optional = true }
2024

2125
[dev-dependencies]

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ anyhow = "1.0"
7575
}
7676
```
7777

78-
- If using Rust 1.65 or `features = ["backtrace"]`, a backtrace is captured
79-
and printed with the error if the underlying error type does not already
80-
provide its own. In order to see backtraces, they must be enabled through the
81-
environment variables described in [`std::backtrace`]:
78+
- If using Rust ≥ 1.65, a backtrace is captured and printed with the error if
79+
the underlying error type does not already provide its own. In order to see
80+
backtraces, they must be enabled through the environment variables described
81+
in [`std::backtrace`]:
8282

8383
- If you want panics and errors to both have backtraces, set
8484
`RUST_BACKTRACE=1`;

src/error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,17 @@ impl Error {
363363
///
364364
/// # Stability
365365
///
366-
/// Standard library backtraces are only available when using Rust ≥ 1.65.
367-
/// On older compilers, this function is only available if the crate's
366+
/// Standard library backtraces are only available when using Rust ≥
367+
/// 1.65. On older compilers, this function is only available if the crate's
368368
/// "backtrace" feature is enabled, and will use the `backtrace` crate as
369-
/// the underlying backtrace implementation.
369+
/// the underlying backtrace implementation. The return type of this
370+
/// function on old compilers is `&(impl Debug + Display)`.
370371
///
371372
/// ```toml
372373
/// [dependencies]
373374
/// anyhow = { version = "1.0", features = ["backtrace"] }
374375
/// ```
375376
#[cfg(any(std_backtrace, feature = "backtrace"))]
376-
#[cfg_attr(doc_cfg, doc(cfg(any(nightly, feature = "backtrace"))))]
377377
pub fn backtrace(&self) -> &impl_backtrace!() {
378378
unsafe { ErrorImpl::backtrace(self.inner.by_ref()) }
379379
}

src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@
128128
//! # ;
129129
//! ```
130130
//!
131-
//! - If using Rust 1.65 or `features = ["backtrace"]`, a backtrace is captured
132-
//! and printed with the error if the underlying error type does not already
133-
//! provide its own. In order to see backtraces, they must be enabled through the
134-
//! environment variables described in [`std::backtrace`]:
131+
//! - If using Rust ≥ 1.65, a backtrace is captured and printed with the
132+
//! error if the underlying error type does not already provide its own. In
133+
//! order to see backtraces, they must be enabled through the environment
134+
//! variables described in [`std::backtrace`]:
135135
//!
136136
//! - If you want panics and errors to both have backtraces, set
137137
//! `RUST_BACKTRACE=1`;

0 commit comments

Comments
 (0)