Update vec.rs

Add a warning not to convert  char* from c to Vec<u8> (I thought you could until I asked on irc)
This commit is contained in:
derekdreery 2017-01-06 15:58:35 +00:00 committed by GitHub
parent 0728b71034
commit 5cb37f6331

View File

@ -370,7 +370,8 @@ pub fn with_capacity(capacity: usize) -> Vec<T> {
/// * `capacity` needs to be the capacity that the pointer was allocated with. /// * `capacity` needs to be the capacity that the pointer was allocated with.
/// ///
/// Violating these may cause problems like corrupting the allocator's /// 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 /// The ownership of `ptr` is effectively transferred to the
/// `Vec<T>` which may then deallocate, reallocate or change the /// `Vec<T>` which may then deallocate, reallocate or change the