Skip to content

Commit

Permalink
account for non-drop-glue types
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 22, 2019
1 parent a7b9246 commit 9196781
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,10 @@ mod prim_unit { }
/// Working with raw pointers in Rust is uncommon, typically limited to a few patterns.
/// Raw pointers can be unaligned or [`null`] when unused. However, when a raw pointer is
/// dereferenced (using the `*` operator), it must be non-null and aligned.
///
/// Storing through a raw pointer using `*ptr = data` calls `drop` on the old value, so
/// [`write`] must be used if memory is not already initialized---otherwise `drop`
/// would be called on the uninitialized memory.
/// [`write`] must be used if the type has drop glue and memory is not already
/// initialized---otherwise `drop` would be called on the uninitialized memory.
///
/// Use the [`null`] and [`null_mut`] functions to create null pointers, and the
/// [`is_null`] method of the `*const T` and `*mut T` types to check for null.
Expand Down

0 comments on commit 9196781

Please sign in to comment.