I am dealing with the tracing crate, which at some point gives me an Box<dyn Error>
and I noticed this type does not implement Error
.
I found that the way the standard library is written, Box<T> where T: Error
only implements Error
when T: Sized
. Is this an oversight or is this intentional? How do I change the Box<dyn Error>
into an error regardless, that I can return using the anyhow crate?
In the standard library, this is the relevant code (link):
impl<T: Error> Error for Box<T> {
Shouldn't the trait be implemented as follows?
impl<T: Error + ?Sized> Error for Box<T> {