Skip to content

Commit

Permalink
Rollup merge of rust-lang#49121 - varkor:stabilise-from_utf8_error_as…
Browse files Browse the repository at this point in the history
…_bytes, r=bluss

Stabilise FromUtf8Error::as_bytes

Closes rust-lang#40895.
  • Loading branch information
kennytm committed Mar 24, 2018
2 parents 537f0d5 + b57ea56 commit cd9981c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1576,15 +1576,14 @@ impl FromUtf8Error {
/// Basic usage:
///
/// ```
/// #![feature(from_utf8_error_as_bytes)]
/// // some invalid bytes, in a vector
/// let bytes = vec![0, 159];
///
/// let value = String::from_utf8(bytes);
///
/// 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[..]
}
Expand Down

0 comments on commit cd9981c

Please sign in to comment.