diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2017-03-07 23:39:49 +0100 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2017-03-07 23:39:49 +0100 |
| commit | 025bf9582eb97d72d71ed54fc52941dbb836cf48 (patch) | |
| tree | 1c60d20735f91bb4ee053a85720c967a814153ca /src | |
| parent | b04ebef43242ade6be8968694caf56a0fb00a4d3 (diff) | |
| download | rust-025bf9582eb97d72d71ed54fc52941dbb836cf48.tar.gz rust-025bf9582eb97d72d71ed54fc52941dbb836cf48.zip | |
Clarify handling of `src` in `ptr::write`
Fixes #39733.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/ptr.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 02851c224e2..260fdab9d58 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -191,6 +191,10 @@ 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. +/// /// This is appropriate for initializing uninitialized memory, or overwriting /// memory that has previously been `read` from. /// |
