diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index eedf4c2c11f3..8ba5c6ffbf2e 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -701,6 +701,12 @@ pub fn from_utf16_lossy(v: &[u16]) -> String { /// Violating these may cause problems like corrupting the allocator's /// internal datastructures. /// + /// The ownership of `ptr` is effectively transferred to the + /// `String` which may then deallocate, reallocate or change the + /// contents of memory pointed to by the pointer at will. Ensure + /// that nothing else uses the pointer after calling this + /// function. + /// /// # Examples /// /// Basic usage: diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index da56b21cf0c0..98b5c4663cd0 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -348,6 +348,12 @@ pub fn with_capacity(capacity: usize) -> Vec { /// Violating these may cause problems like corrupting the allocator's /// internal datastructures. /// + /// The ownership of `ptr` is effectively transferred to the + /// `Vec` which may then deallocate, reallocate or change the + /// contents of memory pointed to by the pointer at will. Ensure + /// that nothing else uses the pointer after calling this + /// function. + /// /// # Examples /// /// ```