File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -395,6 +395,12 @@ impl CString {
395
395
/// ownership of a string that was allocated by foreign code) is likely to lead
396
396
/// to undefined behavior or allocator corruption.
397
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
+ ///
398
404
/// > **Note:** If you need to borrow a string that was allocated by
399
405
/// > foreign code, use [`CStr`]. If you need to take ownership of
400
406
/// > a string that was allocated by foreign code, you will need to
You can’t perform that action at this time.
0 commit comments