diff --git a/library/std/src/error.rs b/library/std/src/error.rs index 605d953f5da71..94338c7b04d06 100644 --- a/library/std/src/error.rs +++ b/library/std/src/error.rs @@ -30,6 +30,7 @@ use crate::mem::transmute; use crate::num; use crate::str; use crate::string; +use crate::sync::Arc; /// `Error` is a trait representing the basic expectations for error values, /// i.e., values of type `E` in [`Result`]. Errors must describe @@ -507,6 +508,27 @@ impl<'a, T: Error + ?Sized> Error for &'a T { } } +#[stable(feature = "arc_error", since = "1.52.0")] +impl Error for Arc { + #[allow(deprecated, deprecated_in_future)] + fn description(&self) -> &str { + Error::description(&**self) + } + + #[allow(deprecated)] + fn cause(&self) -> Option<&dyn Error> { + Error::cause(&**self) + } + + fn source(&self) -> Option<&(dyn Error + 'static)> { + Error::source(&**self) + } + + fn backtrace(&self) -> Option<&Backtrace> { + Error::backtrace(&**self) + } +} + #[stable(feature = "fmt_error", since = "1.11.0")] impl Error for fmt::Error { #[allow(deprecated)]