Skip to content

Commit 8995a3a

Browse files
committed
Merge pull request #351 from aturon/error-chaining-fixup
RFC #70: Added details about downcasting
2 parents de0f802 + 7cf0933 commit 8995a3a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

active/0070-error-chaining.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ implementing `Error`, which makes it possible to read off a kind of
171171
abstract backtrace (often more immediately helpful than a full
172172
backtrace).
173173

174+
The `Any` bound is needed to allow *downcasting* of errors. This RFC
175+
stipulates that it must be possible to downcast errors in the style of
176+
the `Any` trait, but leaves unspecified the exact implementation
177+
strategy. (If trait object upcasting was available, one could simply
178+
upcast to `Any`; otherwise, we will likely need to duplicate the
179+
`downcast` APIs as blanket `impl`s on `Error` objects.)
180+
174181
It's worth comparing the `Error` trait to the most widespread error
175182
type in `libstd`, `IoError`:
176183

0 commit comments

Comments
 (0)