Skip to content

Commit

Permalink
Added a warning to CString::into_raw too
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Jun 3, 2020
1 parent 00a7b56 commit 87abe17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,11 @@ impl CString {
///
/// Failure to call [`from_raw`] will lead to a memory leak.
///
/// The C side must **not** modify the length of the string (by writing a
/// `NULL` somewhere inside the string or removing the final one) before
/// it makes it back into Rust using [`from_raw`]. See the safety section
/// in [`from_raw`].
///
/// [`from_raw`]: #method.from_raw
///
/// # Examples
Expand Down

0 comments on commit 87abe17

Please sign in to comment.