Skip to content

Commit f6be6aa

Browse files
committed
Document from_raw_parts involves ownership transfer
1 parent 6aba7be commit f6be6aa

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/libcollections/string.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,12 @@ impl String {
701701
/// Violating these may cause problems like corrupting the allocator's
702702
/// internal datastructures.
703703
///
704+
/// The ownership of `ptr` is effectively transferred to the
705+
/// `String` which may then deallocate, reallocate or change the
706+
/// contents of memory pointed to by the pointer at will. Ensure
707+
/// that nothing else uses the pointer after calling this
708+
/// function.
709+
///
704710
/// # Examples
705711
///
706712
/// Basic usage:

src/libcollections/vec.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ impl<T> Vec<T> {
348348
/// Violating these may cause problems like corrupting the allocator's
349349
/// internal datastructures.
350350
///
351+
/// The ownership of `ptr` is effectively transferred to the
352+
/// `Vec<T>` which may then deallocate, reallocate or change the
353+
/// contents of memory pointed to by the pointer at will. Ensure
354+
/// that nothing else uses the pointer after calling this
355+
/// function.
356+
///
351357
/// # Examples
352358
///
353359
/// ```

0 commit comments

Comments
 (0)