Skip to content

Commit

Permalink
Added details about downcasting
Browse files Browse the repository at this point in the history
  • Loading branch information
aturon committed Oct 3, 2014
1 parent de0f802 commit 7cf0933
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 7cf0933

Please sign in to comment.