Skip to content

Commit aa8f111

Browse files
authored
Rollup merge of rust-lang#89315 - et342:cstr_from_vec_unchecked_doc, r=yaahc
Clarify that `CString::from_vec_unchecked` appends 0 byte.
2 parents 0fd217c + 9d617f3 commit aa8f111

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

std/src/ffi/c_str.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ impl CString {
409409
/// Creates a C-compatible string by consuming a byte vector,
410410
/// without checking for interior 0 bytes.
411411
///
412+
/// Trailing 0 byte will be appended by this function.
413+
///
412414
/// This method is equivalent to [`CString::new`] except that no runtime
413415
/// assertion is made that `v` contains no 0 bytes, and it requires an
414416
/// actual byte vector, not anything that can be converted to one with Into.

0 commit comments

Comments
 (0)