about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2021-09-29 19:33:41 -0700
committerGitHub <noreply@github.com>2021-09-29 19:33:41 -0700
commite392f5d90d6d0229ee4fa830642cb6e8df0bae03 (patch)
tree1073ea52af328a1259a2992cdbcb8514367edbeb
parent403e221dcfc6ac7f717bc61d81d19b29d833dcb3 (diff)
parentdd0b5f48158ebeb29915fd53cd8f6ef01cc15a93 (diff)
downloadrust-e392f5d90d6d0229ee4fa830642cb6e8df0bae03.tar.gz
rust-e392f5d90d6d0229ee4fa830642cb6e8df0bae03.zip
Rollup merge of #89315 - et342:cstr_from_vec_unchecked_doc, r=yaahc
Clarify that `CString::from_vec_unchecked` appends 0 byte.
-rw-r--r--library/std/src/ffi/c_str.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs
index ba084987f66..fe1f28f00c4 100644
--- a/library/std/src/ffi/c_str.rs
+++ b/library/std/src/ffi/c_str.rs
@@ -409,6 +409,8 @@ impl CString {
     /// Creates a C-compatible string by consuming a byte vector,
     /// without checking for interior 0 bytes.
     ///
+    /// Trailing 0 byte will be appended by this function.
+    ///
     /// This method is equivalent to [`CString::new`] except that no runtime
     /// assertion is made that `v` contains no 0 bytes, and it requires an
     /// actual byte vector, not anything that can be converted to one with Into.