Skip to content

Commit 5cb37f6

Browse files
authored
Update vec.rs
Add a warning not to convert char* from c to Vec<u8> (I thought you could until I asked on irc)
1 parent 0728b71 commit 5cb37f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libcollections/vec.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ impl<T> Vec<T> {
370370
/// * `capacity` needs to be the capacity that the pointer was allocated with.
371371
///
372372
/// Violating these may cause problems like corrupting the allocator's
373-
/// internal datastructures.
373+
/// internal datastructures. For example it is **not** safe
374+
/// to build a `Vec<u8>` from a C pointer to a char array and a `size_t`.
374375
///
375376
/// The ownership of `ptr` is effectively transferred to the
376377
/// `Vec<T>` which may then deallocate, reallocate or change the

0 commit comments

Comments
 (0)