Rollup merge of #49121 - varkor:stabilise-from_utf8_error_as_bytes, r=bluss

Stabilise FromUtf8Error::as_bytes

Closes #40895.
This commit is contained in:
kennytm
2018-03-25 01:26:29 +08:00
committed by GitHub

View File

@@ -1576,7 +1576,6 @@ impl FromUtf8Error {
/// Basic usage:
///
/// ```
/// #![feature(from_utf8_error_as_bytes)]
/// // some invalid bytes, in a vector
/// let bytes = vec![0, 159];
///
@@ -1584,7 +1583,7 @@ impl FromUtf8Error {
///
/// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
/// ```
#[unstable(feature = "from_utf8_error_as_bytes", reason = "recently added", issue = "40895")]
#[stable(feature = "from_utf8_error_as_bytes", since = "1.26.0")]
pub fn as_bytes(&self) -> &[u8] {
&self.bytes[..]
}