mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
Rollup merge of #80553 - derekdreery:arc_error, r=m-ou-se
Add an impl of Error on `Arc<impl Error>`. `Display` already exists so this should be a non-controversial change (famous last words). Would have to be insta-stable.
This commit is contained in:
commit
351d947e54
@ -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<T, E>`]. 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<T: Error + ?Sized> Error for Arc<T> {
|
||||
#[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)]
|
||||
|
Loading…
Reference in New Issue
Block a user