diff options
| author | Ralf Jung <post@ralfj.de> | 2019-07-21 12:13:57 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-07-21 12:13:57 +0200 |
| commit | 40812224cad0d8b89d52fc1ffc3d44e1615794d4 (patch) | |
| tree | 502d26f251ddf51b0c205b6e6e43ae748b454dfe /src/libstd | |
| parent | f502bf78cba8974cdfbd20f3b524d86b982e5e2b (diff) | |
| download | rust-40812224cad0d8b89d52fc1ffc3d44e1615794d4.tar.gz rust-40812224cad0d8b89d52fc1ffc3d44e1615794d4.zip | |
apply feedback
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/primitive_docs.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index 0f66e8cd47e..5fa15f1fbde 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -363,10 +363,11 @@ mod prim_unit { } /// *[See also the `std::ptr` module](ptr/index.html).* /// /// 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 +/// 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 (`*ptr = data`) calls `drop` on the old value, so -/// [`write`] must be used if memory is not already initialized. +/// 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. /// /// 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. @@ -896,7 +897,8 @@ mod prim_usize { } /// operators on a value, or by using a `ref` or `ref mut` pattern. /// /// For those familiar with pointers, a reference is just a pointer that is assumed to be -/// aligned and not null. In fact, `Option<&T>` has the same memory representation as a +/// aligned, not null, and pointing to valid (initialized) memory. +/// In fact, `Option<&T>` has the same memory representation as a /// nullable but aligned pointer, and can be passed across FFI boundaries as such. /// /// In most cases, references can be used much like the original value. Field access, method |
