-
-
Notifications
You must be signed in to change notification settings - Fork 166
Closed
Description
It is common in crates that take the anyhow approach of loosely typed dynamic error types to return Result<T, Box<dyn Error + Send + Sync + 'static>>
.
Like anyhow, this type is convenient to use - automatically coercing from impl Error
and even String
.
But, when trying to interop with this common return value using ?
the compiler stumbles with:
the trait
std::marker::Sized
is not implemented fordyn std::error::Error + std::marker::Send + std::marker::Sync
Here is a minimum reproducible case:
use anyhow;
fn dyn_error() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
Ok(())
}
fn anyhow_error() -> Result<(), anyhow::Error> {
dyn_error()?;
Ok(())
}
Metadata
Metadata
Assignees
Labels
No labels