Skip to content

Commit 9196781

Browse files
committed
account for non-drop-glue types
1 parent a7b9246 commit 9196781

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libstd/primitive_docs.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,10 @@ mod prim_unit { }
365365
/// Working with raw pointers in Rust is uncommon, typically limited to a few patterns.
366366
/// Raw pointers can be unaligned or [`null`] when unused. However, when a raw pointer is
367367
/// dereferenced (using the `*` operator), it must be non-null and aligned.
368+
///
368369
/// Storing through a raw pointer using `*ptr = data` calls `drop` on the old value, so
369-
/// [`write`] must be used if memory is not already initialized---otherwise `drop`
370-
/// would be called on the uninitialized memory.
370+
/// [`write`] must be used if the type has drop glue and memory is not already
371+
/// initialized---otherwise `drop` would be called on the uninitialized memory.
371372
///
372373
/// Use the [`null`] and [`null_mut`] functions to create null pointers, and the
373374
/// [`is_null`] method of the `*const T` and `*mut T` types to check for null.

0 commit comments

Comments
 (0)