Skip to content

Commit aea8010

Browse files
author
Ariel Ben-Yehuda
authored
Rollup merge of rust-lang#40333 - tbu-:pr_doc_ptr_write, r=alexcrichton
Clarify handling of `src` in `ptr::write` Fixes rust-lang#39733.
2 parents e8eb05c + 025bf95 commit aea8010

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/ptr.rs

+4
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
191191
/// allocations or resources, so care must be taken not to overwrite an object
192192
/// that should be dropped.
193193
///
194+
/// It does not immediately drop the contents of `src` either; it is rather
195+
/// *moved* into the memory location `dst` and will be dropped whenever that
196+
/// location goes out of scope.
197+
///
194198
/// This is appropriate for initializing uninitialized memory, or overwriting
195199
/// memory that has previously been `read` from.
196200
///

0 commit comments

Comments
 (0)