Hey @rustlang twitter: any particular reason that there isn't an instance of std::error::Error for Arc<dyn std::error::Error>?
Would be quite useful when you want a cloneable dyn error for just exploring things without being bogged down in error handling intricacies...
-
-
Arc<dyn Error> and Box<dyn Error> cannot impl Error due to the overlap rule which says currently in rust you cannot have two generic trait impls both be valid for the same type. From<T> for Arc<T> and From<T> for T would overlap if Arc<dyn Error> itself could coerce to dyn Error
2 replies 0 retweets 5 likes -
This would be true if there was `impl<E: Error> From<E> for Arc<dyn Error>`, but there is no such impl. Only for Box.
1 reply 0 retweets 1 like -
Oh yea you need a concrete impl don't you, I forgot the From<T> doesn't work as a coersion site for dyn Error.
1 reply 0 retweets 0 likes -
Either way, you can't meaningfully get what
@klaehnr wants which is presumably a catch all error type via Arc that itself impls Error. Side question, Sian do you know if specialization is planned to allow overlap?2 replies 0 retweets 0 likes -
You definitely could write `impl<E: Error + ?Sized> Error for Arc<E>`.There's nothing incoherent about it.
1 reply 0 retweets 1 like -
Yaah 🦀 Retweeted Yaah 🦀
Yaah 🦀 added,
1 reply 0 retweets 0 likes
The `Sized` bound doesn't need to be there
-
-
Or rather could be `?Sized`
2 replies 0 retweets 0 likes -
But it will match `dyn Error`, resulting in same conflict again.
1 reply 0 retweets 1 like - 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.