Core::errors::Error is stable now (#2664)

This commit is contained in:
Dominik Maier 2024-11-05 16:48:31 +01:00 committed by GitHub
parent 8de9dcaff7
commit b5c9bffe50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
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.
#[cfg(feature = "prelude")]
pub mod prelude {