diff options
| author | Jane Losare-Lusby <jlusby@yaah.dev> | 2022-07-29 18:54:47 +0000 |
|---|---|---|
| committer | Jane Lusby <jlusby@yaah.dev> | 2022-08-22 13:28:25 -0700 |
| commit | bf7611d55ee6e24647aefc4d1c82b1dba0164536 (patch) | |
| tree | ca210f013c939a839c776ca63dcbcbfebbc4f564 /library/alloc/src/ffi | |
| parent | e0dc8d78019ca924203fe153ff0af7f64f68cb5d (diff) | |
| download | rust-bf7611d55ee6e24647aefc4d1c82b1dba0164536.tar.gz rust-bf7611d55ee6e24647aefc4d1c82b1dba0164536.zip | |
Move error trait into core
Diffstat (limited to 'library/alloc/src/ffi')
| -rw-r--r-- | library/alloc/src/ffi/c_str.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index be21d8c722d..aede6d54c6c 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -1121,3 +1121,29 @@ impl CStr { CString::from(self) } } + +#[cfg(not(bootstrap))] +#[stable(feature = "rust1", since = "1.0.0")] +impl core::error::Error for NulError { + #[allow(deprecated)] + fn description(&self) -> &str { + "nul byte found in data" + } +} + +#[cfg(not(bootstrap))] +#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")] +impl core::error::Error for FromVecWithNulError {} + +#[cfg(not(bootstrap))] +#[stable(feature = "cstring_into", since = "1.7.0")] +impl core::error::Error for IntoStringError { + #[allow(deprecated)] + fn description(&self) -> &str { + "C string contained non-utf8 bytes" + } + + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + Some(self.__source()) + } +} |
