From 7cf0933b44e5ed0aafa5e29b8eb4363f7727c1b4 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Fri, 3 Oct 2014 11:18:33 -0700 Subject: [PATCH] Added details about downcasting --- active/0070-error-chaining.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/active/0070-error-chaining.md b/active/0070-error-chaining.md index ff18003be8ff2..a6ee66b1ce2af 100644 --- a/active/0070-error-chaining.md +++ b/active/0070-error-chaining.md @@ -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`: