From 5cb37f6331cb97a0d644d3ff753e73dd7bf66604 Mon Sep 17 00:00:00 2001 From: derekdreery Date: Fri, 6 Jan 2017 15:58:35 +0000 Subject: 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(-) (limited to 'src') 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 @@ impl 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 -- cgit 1.4.1-3-g733a5 From 0a85d5f7f355e7e04e97e27e2613c9831daa67a7 Mon Sep 17 00:00:00 2001 From: derekdreery Date: Fri, 6 Jan 2017 18:17:18 +0000 Subject: Update vec.rs Changed language to stress char is the C meaning (u8) not unicode. --- src/libcollections/vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3c9a9897fea..12eac3c96ee 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -371,7 +371,7 @@ impl Vec { /// /// Violating these may cause problems like corrupting the allocator's /// internal datastructures. For example it is **not** safe - /// to build a `Vec` from a C pointer to a char array and a `size_t`. + /// to build a `Vec` from a pointer to a C `char` array and a `size_t`. /// /// The ownership of `ptr` is effectively transferred to the /// `Vec` which may then deallocate, reallocate or change the -- cgit 1.4.1-3-g733a5