about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2025-04-18 11:18:25 -0400
committerTamir Duberstein <tamird@gmail.com>2025-06-12 12:53:14 -0400
commita82062055af1ecdcb7f4d3371855aae843fc0ae3 (patch)
tree2d97d6709ee8862732412220478aef2f6bf92801 /library/alloc/src
parent6c8138de8f1c96b2f66adbbc0e37c73525444750 (diff)
downloadrust-a82062055af1ecdcb7f4d3371855aae843fc0ae3.tar.gz
rust-a82062055af1ecdcb7f4d3371855aae843fc0ae3.zip
Delegate `<CStr as Debug>` to `ByteStr`
This allows UTF-8 characters to be printed without escapes, rather than
just ASCII.
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/ffi/c_str.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index 8b448a18402..48849bf7536 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -714,6 +714,8 @@ impl ops::Deref for CString {
     }
 }
 
+/// Delegates to the [`CStr`] implementation of [`fmt::Debug`],
+/// showing invalid UTF-8 as hex escapes.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Debug for CString {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {