Core::errors::Error is stable now (#2664)
This commit is contained in:
parent
8de9dcaff7
commit
b5c9bffe50
@ -451,6 +451,17 @@ impl Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl core::error::Error for Error {
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||||
|
if let Self::OsError(err, _, _) = self {
|
||||||
|
Some(err)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Display for Error {
|
impl Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
@ -638,12 +649,6 @@ impl From<pyo3::PyErr> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(not(nightly), feature = "std"))]
|
|
||||||
impl std::error::Error for Error {}
|
|
||||||
|
|
||||||
#[cfg(nightly)]
|
|
||||||
impl core::error::Error for Error {}
|
|
||||||
|
|
||||||
/// The purpose of this module is to alleviate imports of many components by adding a glob import.
|
/// The purpose of this module is to alleviate imports of many components by adding a glob import.
|
||||||
#[cfg(feature = "prelude")]
|
#[cfg(feature = "prelude")]
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user