summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/alloc/src/string.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index 24f1b3a1c87..3118c7189a5 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -2549,6 +2549,15 @@ impl ToString for char {
}
#[cfg(not(no_global_oom_handling))]
+#[stable(feature = "bool_to_string_specialization", since = "CURRENT_RUSTC_VERSION")]
+impl ToString for bool {
+ #[inline]
+ fn to_string(&self) -> String {
+ String::from(if *self { "true" } else { "false" })
+ }
+}
+
+#[cfg(not(no_global_oom_handling))]
#[stable(feature = "u8_to_string_specialization", since = "1.54.0")]
impl ToString for u8 {
#[inline]