use core::fmt::{Debug, Display};
pub trait Error: Debug + Display {
fn description(&self) -> &str {
"description() is deprecated; use Display"
}
fn cause(&self) -> Option<&Error> {
self.source()
}
fn source(&self) -> Option<&(Error + 'static)> {
None
}
}
macro_rules! impl_error {
($( #[$version:meta] $ty:path),*) => {
$(
#[$version]
impl Error for $ty { }
)*
};
}
impl_error! {
#[cfg(rustc_1_0_0)] ::core::str::ParseBoolError,
#[cfg(rustc_1_0_0)] ::core::str::Utf8Error,
#[cfg(rustc_1_0_0)] ::core::num::ParseIntError,
#[cfg(rustc_1_0_0)] ::core::num::ParseFloatError,
#[cfg(rustc_1_11_0)] ::core::fmt::Error,
#[cfg(rustc_1_13_0)] ::core::cell::BorrowMutError,
#[cfg(rustc_1_13_0)] ::core::cell::BorrowError,
#[cfg(rustc_1_20_0)] ::core::char::ParseCharError,
#[cfg(rustc_1_27_0)] ::core::char::DecodeUtf16Error,
#[cfg(rustc_1_34_0)] ::core::num::TryFromIntError,
#[cfg(rustc_1_34_0)] ::core::array::TryFromSliceError,
#[cfg(rustc_1_34_0)] ::core::char::CharTryFromError
}