Document from_raw_parts involves ownership transfer

This commit is contained in:
Jake Goulding
2016-07-17 10:52:59 -04:00
parent 6aba7be9a6
commit f6be6aa92a
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -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:
+6
View File
@@ -348,6 +348,12 @@ pub fn with_capacity(capacity: usize) -> Vec<T> {
/// Violating these may cause problems like corrupting the allocator's
/// internal datastructures.
///
/// The ownership of `ptr` is effectively transferred to the
/// `Vec<T>` 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
///
/// ```