File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -362,8 +362,11 @@ mod prim_unit { }
362
362
///
363
363
/// *[See also the `std::ptr` module](ptr/index.html).*
364
364
///
365
- /// Working with raw pointers in Rust is uncommon,
366
- /// typically limited to a few patterns.
365
+ /// Working with raw pointers in Rust is uncommon, typically limited to a few patterns.
366
+ /// Raw pointers can be unaligned or null when unused. However, when a raw pointer is used to
367
+ /// load/store data from/to memory, they must be non-null and aligned.
368
+ /// Storing through a raw pointer (`*ptr = data`) calls `drop` on the old value, so
369
+ /// [`write`] must be used if memory is not already initialized.
367
370
///
368
371
/// Use the [`null`] and [`null_mut`] functions to create null pointers, and the
369
372
/// [`is_null`] method of the `*const T` and `*mut T` types to check for null.
@@ -442,6 +445,7 @@ mod prim_unit { }
442
445
/// [`offset`]: ../std/primitive.pointer.html#method.offset
443
446
/// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw
444
447
/// [`drop`]: ../std/mem/fn.drop.html
448
+ /// [`write`]: ../std/ptr/fn.write.html
445
449
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
446
450
mod prim_pointer { }
447
451
You can’t perform that action at this time.
0 commit comments