Auto merge of #28965 - bluss:ptr-write-doc, r=huonw
core: Update the safety docs for core::ptr::write Updated to reflect that not dropping a value is safe (but discouraged).
This commit is contained in:
commit
db6c7124b4
1 changed files with 5 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue