Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,15 @@ impl ToString for char {
}
}

#[stable(feature = "u8_to_string_specialization", since="1.999.0")]
impl ToString for u8 {
#[inline]
fn to_string(&self) -> String {
// Encode utf8 panics if not valid utf8.
String::from((*self as char).encode_utf8(&mut [0; 1]))
}
}

#[stable(feature = "str_to_string_specialization", since = "1.9.0")]
impl ToString for str {
#[inline]
Expand Down