File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -362,8 +362,11 @@ mod prim_unit { }
362362///
363363/// *[See also the `std::ptr` module](ptr/index.html).*
364364///
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.
367370///
368371/// Use the [`null`] and [`null_mut`] functions to create null pointers, and the
369372/// [`is_null`] method of the `*const T` and `*mut T` types to check for null.
@@ -442,6 +445,7 @@ mod prim_unit { }
442445/// [`offset`]: ../std/primitive.pointer.html#method.offset
443446/// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw
444447/// [`drop`]: ../std/mem/fn.drop.html
448+ /// [`write`]: ../std/ptr/fn.write.html
445449#[ stable( feature = "rust1" , since = "1.0.0" ) ]
446450mod prim_pointer { }
447451
You can’t perform that action at this time.
0 commit comments