diff options
| author | Ulrik Sverdrup <bluss@users.noreply.github.com> | 2015-10-11 13:40:47 +0200 |
|---|---|---|
| committer | Ulrik Sverdrup <bluss@users.noreply.github.com> | 2015-10-11 13:40:47 +0200 |
| commit | 4dee42fe5825b579ad4c0c2efc3a67c9aabe693b (patch) | |
| tree | 5e57531e79e5c5bf6167bc67f6b22af31517a2cc /src | |
| parent | 9d3e79ad3728f6723f8e49908696e66a68d7db95 (diff) | |
| download | rust-4dee42fe5825b579ad4c0c2efc3a67c9aabe693b.tar.gz rust-4dee42fe5825b579ad4c0c2efc3a67c9aabe693b.zip | |
core: Update the safety docs for core::ptr::write
Updated to reflect that not dropping a value is safe (but discouraged).
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/ptr.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 831616293cd..4ca32b5a366 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -145,9 +145,11 @@ pub unsafe fn read_and_drop<T>(dest: *mut T) -> T { /// /// # Safety /// -/// Beyond accepting a raw pointer, this operation is unsafe because it does -/// not drop the contents of `dst`. This could leak allocations or resources, -/// so care must be taken not to overwrite an object that should be dropped. +/// This operation is marked unsafe because it accepts a raw pointer. +/// +/// It does not drop the contents of `dst`. This is safe, but it could leak +/// allocations or resources, so care must be taken not to overwrite an object +/// that should be dropped. /// /// This is appropriate for initializing uninitialized memory, or overwriting /// memory that has previously been `read` from. |
