File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -425,6 +425,14 @@ impl Report {
425
425
}
426
426
. into ( )
427
427
}
428
+
429
+ /// Construct a [`Report`] directly from an error-like type
430
+ pub fn from_err < E > ( err : E ) -> Self
431
+ where
432
+ E : std:: error:: Error + Send + Sync + ' static ,
433
+ {
434
+ super :: DiagnosticError ( Box :: new ( err) ) . into ( )
435
+ }
428
436
}
429
437
430
438
impl < E > From < E > for Report
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use crate::{Diagnostic, Report};
6
6
/// Errors. This is intended to be paired with [`IntoDiagnostic`].
7
7
#[ derive( Debug , Error ) ]
8
8
#[ error( transparent) ]
9
- struct DiagnosticError ( Box < dyn std:: error:: Error + Send + Sync + ' static > ) ;
9
+ pub ( crate ) struct DiagnosticError ( pub ( crate ) Box < dyn std:: error:: Error + Send + Sync + ' static > ) ;
10
10
impl Diagnostic for DiagnosticError { }
11
11
12
12
/**
You can’t perform that action at this time.
0 commit comments