Skip to content

Commit

Permalink
Update vec.rs
Browse files Browse the repository at this point in the history
Add a warning not to convert  char* from c to Vec<u8> (I thought you could until I asked on irc)
  • Loading branch information
richard-uk1 authored Jan 6, 2017
1 parent 0728b71 commit 5cb37f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ impl<T> Vec<T> {
/// * `capacity` needs to be the capacity that the pointer was allocated with.
///
/// Violating these may cause problems like corrupting the allocator's
/// internal datastructures.
/// internal datastructures. For example it is **not** safe
/// to build a `Vec<u8>` from a C pointer to a char array and a `size_t`.
///
/// The ownership of `ptr` is effectively transferred to the
/// `Vec<T>` which may then deallocate, reallocate or change the
Expand Down

0 comments on commit 5cb37f6

Please sign in to comment.