提交 f6be6aa9 编写于 作者: J Jake Goulding

Document from_raw_parts involves ownership transfer

上级 6aba7be9
......@@ -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:
......
......@@ -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
///
/// ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册