Skip to content

Commit 164477d

Browse files
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 05038de + dd0b5f4 commit 164477d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: library/std/src/ffi/c_str.rs

+2
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)