Skip to content

Commit 025bf95

Browse files
committed
Clarify handling of src in ptr::write
Fixes #39733.
1 parent b04ebef commit 025bf95

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)