diff --git a/src/librustrt/c_str.rs b/src/librustrt/c_str.rs index 0f2fcaff310..c30b267219b 100644 --- a/src/librustrt/c_str.rs +++ b/src/librustrt/c_str.rs @@ -73,6 +73,7 @@ use collections::hash; use core::kinds::marker; use core::mem; use core::ptr; +use core::fmt; use core::raw::Slice; use core::slice; use core::str; @@ -344,6 +345,12 @@ impl Collection for CString { } } +impl fmt::Show for CString { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + String::from_utf8_lossy(self.as_bytes_no_nul()).fmt(f) + } +} + /// A generic trait for converting a value to a CString. pub trait ToCStr { /// Copy the receiver into a CString.