Move error trait into core

This commit is contained in:
Jane Losare-Lusby
2022-07-29 18:54:47 +00:00
committed by Jane Lusby
parent e0dc8d7801
commit bf7611d55e
25 changed files with 1264 additions and 226 deletions

View File

@@ -76,6 +76,15 @@ impl fmt::Debug for Error {
}
}
#[cfg(not(bootstrap))]
#[stable(feature = "rust1", since = "1.0.0")]
impl From<alloc::ffi::NulError> for Error {
/// Converts a [`alloc::ffi::NulError`] into a [`Error`].
fn from(_: alloc::ffi::NulError) -> Error {
const_io_error!(ErrorKind::InvalidInput, "data provided contains a nul byte")
}
}
// Only derive debug in tests, to make sure it
// doesn't accidentally get printed.
#[cfg_attr(test, derive(Debug))]