Skip to content

Commit 8557ca5

Browse files
efenniht-furiosadkim
authored andcommitted
Requires that errors are Send/Sync/'static (apply PR rust-lang-deprecated#241.)
1 parent 810f671 commit 8557ca5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/error_chain.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ macro_rules! impl_error_chain_processed {
231231

232232
fn with_chain<E, K>(error: E, kind: K)
233233
-> Self
234-
where E: ::std::error::Error + Send + 'static,
234+
where E: ::std::error::Error + Send + Sync + 'static,
235235
K: Into<Self::ErrorKind>
236236
{
237237
Self::with_chain(error, kind)
@@ -273,15 +273,15 @@ macro_rules! impl_error_chain_processed {
273273
/// Constructs a chained error from another error and a kind, and generates a backtrace.
274274
pub fn with_chain<E, K>(error: E, kind: K)
275275
-> $error_name
276-
where E: ::std::error::Error + Send + 'static,
276+
where E: ::std::error::Error + Send + Sync + 'static,
277277
K: Into<$error_kind_name>
278278
{
279279
$error_name::with_boxed_chain(Box::new(error), kind)
280280
}
281281

282282
/// Construct a chained error from another boxed error and a kind, and generates a backtrace
283283
#[allow(unknown_lints, bare_trait_objects)]
284-
pub fn with_boxed_chain<K>(error: Box<::std::error::Error + Send>, kind: K)
284+
pub fn with_boxed_chain<K>(error: Box<::std::error::Error + Send + Sync>, kind: K)
285285
-> $error_name
286286
where K: Into<$error_kind_name>
287287
{
@@ -426,7 +426,7 @@ macro_rules! impl_error_chain_processed {
426426
EK: Into<$error_kind_name>;
427427
}
428428

429-
impl<T, E> $result_ext_name<T> for ::std::result::Result<T, E> where E: ::std::error::Error + Send + 'static {
429+
impl<T, E> $result_ext_name<T> for ::std::result::Result<T, E> where E: ::std::error::Error + Send + Sync + 'static {
430430
fn chain_err<F, EK>(self, callback: F) -> ::std::result::Result<T, $error_name>
431431
where F: FnOnce() -> EK,
432432
EK: Into<$error_kind_name> {
@@ -545,7 +545,7 @@ macro_rules! impl_extract_backtrace {
545545
$([$link_error_path: path, $(#[$meta_links: meta])*])*) => {
546546
#[allow(unknown_lints, renamed_and_removed_lints, bare_trait_objects)]
547547
#[allow(unused_doc_comment, unused_doc_comments)]
548-
fn extract_backtrace(e: &(::std::error::Error + Send + 'static))
548+
fn extract_backtrace(e: &(::std::error::Error + Send + Sync + 'static))
549549
-> Option<$crate::InternalBacktrace> {
550550
if let Some(e) = e.downcast_ref::<$error_name>() {
551551
return Some(e.1.backtrace.clone());

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ impl<'a> Iterator for Iter<'a> {
592592

593593
/// This trait is implemented on all the errors generated by the `error_chain`
594594
/// macro.
595-
pub trait ChainedError: error::Error + Send + 'static {
595+
pub trait ChainedError: error::Error + Send + Sync + 'static {
596596
/// Associated kind type.
597597
type ErrorKind;
598598

@@ -605,7 +605,7 @@ pub trait ChainedError: error::Error + Send + 'static {
605605
fn with_chain<E, K>(error: E, kind: K) -> Self
606606
where
607607
Self: Sized,
608-
E: ::std::error::Error + Send + 'static,
608+
E: ::std::error::Error + Send + Sync + 'static,
609609
K: Into<Self::ErrorKind>;
610610

611611
/// Returns the kind of the error.
@@ -641,7 +641,7 @@ pub trait ChainedError: error::Error + Send + 'static {
641641
/// of the errors from `foreign_links`.
642642
#[doc(hidden)]
643643
#[allow(unknown_lints, bare_trait_objects)]
644-
fn extract_backtrace(e: &(error::Error + Send + 'static)) -> Option<InternalBacktrace>
644+
fn extract_backtrace(e: &(error::Error + Send + Sync + 'static)) -> Option<InternalBacktrace>
645645
where
646646
Self: Sized;
647647
}
@@ -675,7 +675,7 @@ where
675675
#[allow(unknown_lints, bare_trait_objects)]
676676
pub struct State {
677677
/// Next error in the error chain.
678-
pub next_error: Option<Box<error::Error + Send>>,
678+
pub next_error: Option<Box<error::Error + Send + Sync>>,
679679
/// Backtrace for the current error.
680680
pub backtrace: InternalBacktrace,
681681
}
@@ -692,7 +692,7 @@ impl Default for State {
692692
impl State {
693693
/// Creates a new State type
694694
#[allow(unknown_lints, bare_trait_objects)]
695-
pub fn new<CE: ChainedError>(e: Box<error::Error + Send>) -> State {
695+
pub fn new<CE: ChainedError>(e: Box<error::Error + Send + Sync>) -> State {
696696
let backtrace = CE::extract_backtrace(&*e).unwrap_or_else(InternalBacktrace::new);
697697
State {
698698
next_error: Some(e),

0 commit comments

Comments
 (0)