Skip to content

Commit

Permalink
Merge pull request rust-lang#351 from aturon/error-chaining-fixup
Browse files Browse the repository at this point in the history
RFC rust-lang#70: Added details about downcasting
  • Loading branch information
alexcrichton committed Oct 3, 2014
2 parents de0f802 + 7cf0933 commit 8995a3a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions active/0070-error-chaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ implementing `Error`, which makes it possible to read off a kind of
abstract backtrace (often more immediately helpful than a full
backtrace).

The `Any` bound is needed to allow *downcasting* of errors. This RFC
stipulates that it must be possible to downcast errors in the style of
the `Any` trait, but leaves unspecified the exact implementation
strategy. (If trait object upcasting was available, one could simply
upcast to `Any`; otherwise, we will likely need to duplicate the
`downcast` APIs as blanket `impl`s on `Error` objects.)

It's worth comparing the `Error` trait to the most widespread error
type in `libstd`, `IoError`:

Expand Down

0 comments on commit 8995a3a

Please sign in to comment.