1
Fork 0

std: Stabilize the Utf8Error type

The meaning of each variant of this enum was somewhat ambiguous and it's uncler
that we wouldn't even want to add more enumeration values in the future. As a
result this error has been altered to instead become an opaque structure.
Learning about the "first invalid byte index" is still an unstable feature, but
the type itself is now stable.
This commit is contained in:
Alex Crichton 2015-04-10 16:05:09 -07:00
parent c897ac04e2
commit f329030b09
6 changed files with 26 additions and 38 deletions

View file

@ -122,10 +122,7 @@ impl Error for str::ParseBoolError {
#[stable(feature = "rust1", since = "1.0.0")]
impl Error for str::Utf8Error {
fn description(&self) -> &str {
match *self {
str::Utf8Error::TooShort => "invalid utf-8: not enough bytes",
str::Utf8Error::InvalidByte(..) => "invalid utf-8: corrupt contents",
}
"invalid utf-8: corrupt contents"
}
}