diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index ee9125685716..0a685e13f79a 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -824,6 +824,15 @@ impl FromStr for CString { } } +impl TryInto for CString { + type Error = IntoStringError; + + #[inline] + fn try_into(self) -> Result { + self.into_string() + } +} + #[cfg(not(test))] #[stable(feature = "more_box_slice_clone", since = "1.29.0")] impl Clone for Box {