We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eeaf497 commit 00a7b56Copy full SHA for 00a7b56
src/libstd/ffi/c_str.rs
@@ -395,6 +395,12 @@ impl CString {
395
/// ownership of a string that was allocated by foreign code) is likely to lead
396
/// to undefined behavior or allocator corruption.
397
///
398
+ /// It should be noted that the length isn't just "recomputed," but that
399
+ /// the recomputed length must match the original length from the
400
+ /// [`into_raw`] call. This means the [`into_raw`]/`from_raw` methods
401
+ /// should not be used when passing the string to C functions that can
402
+ /// modify the string's length.
403
+ ///
404
/// > **Note:** If you need to borrow a string that was allocated by
405
/// > foreign code, use [`CStr`]. If you need to take ownership of
406
/// > a string that was allocated by foreign code, you will need to
0 commit comments