mirror of https://github.com/zkat/miette.git
fix(protocol): fix the default From<:T Diagnostic> implementation to cover more cases.
This commit is contained in:
parent
40133a368d
commit
781a51f037
|
|
@ -39,12 +39,24 @@ pub trait Diagnostic: std::error::Error {
|
|||
|
||||
impl std::error::Error for Box<dyn Diagnostic> {}
|
||||
|
||||
impl<T: Diagnostic + 'static> From<T> for Box<dyn Diagnostic> {
|
||||
impl<T: Diagnostic + Send + Sync + 'static> From<T> for Box<dyn Diagnostic + Send + Sync + 'static> {
|
||||
fn from(diag: T) -> Self {
|
||||
Box::new(diag)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Diagnostic + Send + Sync + 'static> From<T> for Box<dyn Diagnostic + Send + 'static> {
|
||||
fn from(diag: T) -> Self {
|
||||
Box::<dyn Diagnostic + Send + Sync>::from(diag)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Diagnostic + Send + Sync + 'static> From<T> for Box<dyn Diagnostic + 'static> {
|
||||
fn from(diag: T) -> Self {
|
||||
Box::<dyn Diagnostic + Send + Sync>::from(diag)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Protocol for [Diagnostic] handlers, which are responsible for actually printing out Diagnostics.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue