From 5cb37f6331cb97a0d644d3ff753e73dd7bf66604 Mon Sep 17 00:00:00 2001 From: derekdreery Date: Fri, 6 Jan 2017 15:58:35 +0000 Subject: [PATCH] Update vec.rs Add a warning not to convert char* from c to Vec (I thought you could until I asked on irc) --- src/libcollections/vec.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index f2ef54f6e56..3c9a9897fea 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -370,7 +370,8 @@ pub fn with_capacity(capacity: usize) -> Vec { /// * `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` from a C pointer to a char array and a `size_t`. /// /// The ownership of `ptr` is effectively transferred to the /// `Vec` which may then deallocate, reallocate or change the