Skip to content

Commit 9854e83

Browse files
Remove the implication that CString contains UTF-8 data.
1 parent 4143422 commit 9854e83

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/libstd/ffi/c_str.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ use ptr;
2323
use slice;
2424
use str::{self, Utf8Error};
2525

26-
/// A type representing an owned, C-compatible, UTF-8 string.
26+
/// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the
27+
/// middle.
2728
///
2829
/// This type serves the purpose of being able to safely generate a
29-
/// C-compatible UTF-8 string from a Rust byte slice or vector. An instance of this
30+
/// C-compatible string from a Rust byte slice or vector. An instance of this
3031
/// type is a static guarantee that the underlying bytes contain no interior 0
3132
/// bytes ("nul characters") and that the final byte is 0 ("nul terminator").
3233
///
@@ -443,7 +444,7 @@ impl CString {
443444
Box::into_raw(self.into_inner()) as *mut c_char
444445
}
445446

446-
/// Converts the `CString` into a [`String`] if it contains valid Unicode data.
447+
/// Converts the `CString` into a [`String`] if it contains valid UTF-8 data.
447448
///
448449
/// On failure, ownership of the original `CString` is returned.
449450
///

0 commit comments

Comments
 (0)