Skip to content

Commit

Permalink
Merge pull request #197 from dtolnay/backtracedoc
Browse files Browse the repository at this point in the history
Fix documentation mentioning `backtrace()` method
  • Loading branch information
dtolnay committed Sep 27, 2022
2 parents 7b226e3 + c2759ce commit 3a0bac2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -124,8 +124,8 @@ pub enum DataStoreError {
}
```

- The Error trait's `backtrace()` method is implemented to return whichever
field has a type named `Backtrace`, if any.
- The Error trait's `provide()` method is implemented to provide whichever field
has a type named `Backtrace`, if any, as a `std::backtrace::Backtrace`.

```rust
use std::backtrace::Backtrace;
Expand All @@ -138,8 +138,9 @@ pub enum DataStoreError {
```

- If a field is both a source (named `source`, or has `#[source]` or `#[from]`
attribute) *and* is marked `#[backtrace]`, then the Error trait's
`backtrace()` method is forwarded to the source's backtrace.
attribute) *and* is marked `#[backtrace]`, then the Error trait's `provide()`
method is forwarded to the source's `provide` so that both layers of the error
share the same backtrace.

```rust
#[derive(Error, Debug)]
Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Expand Up @@ -146,8 +146,9 @@
//! # }
//! ```
//!
//! - The Error trait's `backtrace()` method is implemented to return whichever
//! field has a type named `Backtrace`, if any.
//! - The Error trait's `provide()` method is implemented to provide whichever
//! field has a type named `Backtrace`, if any, as a
//! `std::backtrace::Backtrace`.
//!
//! ```rust
//! # const IGNORE: &str = stringify! {
Expand All @@ -163,7 +164,8 @@
//!
//! - If a field is both a source (named `source`, or has `#[source]` or
//! `#[from]` attribute) *and* is marked `#[backtrace]`, then the Error
//! trait's `backtrace()` method is forwarded to the source's backtrace.
//! trait's `provide()` method is forwarded to the source's `provide` so that
//! both layers of the error share the same backtrace.
//!
//! ```rust
//! # const IGNORE: &str = stringify! {
Expand Down

0 comments on commit 3a0bac2

Please sign in to comment.