Skip to content

Commit

Permalink
Merge pull request #155 from cosmicexplorer/derive-unwindsafe
Browse files Browse the repository at this point in the history
add UnwindSafe impl for AsDynError
  • Loading branch information
dtolnay committed Oct 9, 2021
2 parents 00956f1 + 2fd08cc commit 5c62f5e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/aserror.rs
@@ -1,4 +1,5 @@
use std::error::Error;
use std::panic::UnwindSafe;

pub trait AsDynError<'a> {
fn as_dyn_error(&self) -> &(dyn Error + 'a);
Expand Down Expand Up @@ -31,3 +32,10 @@ impl<'a> AsDynError<'a> for dyn Error + Send + Sync + 'a {
self
}
}

impl<'a> AsDynError<'a> for dyn Error + Send + Sync + UnwindSafe + 'a {
#[inline]
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
self
}
}

0 comments on commit 5c62f5e

Please sign in to comment.