Skip to content

Commit

Permalink
Rollup merge of rust-lang#40387 - tbu-:pr_doc_ptr_write2, r=steveklabnik
Browse files Browse the repository at this point in the history
Reword the non-dropping of `src` for `ptr::write{,_unaligned}`

@niconii Is it OK if I put your wording into the documentation?
CC @nagisa
  • Loading branch information
frewsxcv authored Mar 17, 2017
2 parents 0aeb9c1 + 13341f4 commit 8523680
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,8 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
/// allocations or resources, so care must be taken not to overwrite an object
/// that should be dropped.
///
/// It does not immediately drop the contents of `src` either; it is rather
/// *moved* into the memory location `dst` and will be dropped whenever that
/// location goes out of scope.
/// Additionally, it does not drop `src`. Semantically, `src` is moved into the
/// location pointed to by `dst`.
///
/// This is appropriate for initializing uninitialized memory, or overwriting
/// memory that has previously been `read` from.
Expand Down Expand Up @@ -233,6 +232,9 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
/// allocations or resources, so care must be taken not to overwrite an object
/// that should be dropped.
///
/// Additionally, it does not drop `src`. Semantically, `src` is moved into the
/// location pointed to by `dst`.
///
/// This is appropriate for initializing uninitialized memory, or overwriting
/// memory that has previously been `read` from.
///
Expand Down

0 comments on commit 8523680

Please sign in to comment.