Rollup merge of #39960 - lukaramu:issue-39925, r=alexcrichton
added Error and Display impl for std::ffi::FromBytesWithNulError Fixes #39925. This is my first PR, so I wasn't quite sure about the stability annotation.
This commit is contained in:
commit
06a0233ab3
|
@ -455,6 +455,20 @@ impl From<NulError> for io::Error {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")]
|
||||
impl Error for FromBytesWithNulError {
|
||||
fn description(&self) -> &str {
|
||||
"data provided is not null terminated or contains an interior nul byte"
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")]
|
||||
impl fmt::Display for FromBytesWithNulError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.description().fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoStringError {
|
||||
/// Consumes this error, returning original `CString` which generated the
|
||||
/// error.
|
||||
|
|
Loading…
Reference in New Issue