about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-07-23 17:48:01 +0200
committerGitHub <noreply@github.com>2019-07-23 17:48:01 +0200
commitdd5045ed630b7577296087f09f559bb9c08f68e2 (patch)
tree7c1b6095836d0a1dd273104306bf0731744c6b0b /src/libstd
parent91967816c3851b4b796ce774bde49a9f47681bca (diff)
downloadrust-dd5045ed630b7577296087f09f559bb9c08f68e2.tar.gz
rust-dd5045ed630b7577296087f09f559bb9c08f68e2.zip
Apply suggestions from code review
Co-Authored-By: gnzlbg <gnzlbg@users.noreply.github.com>
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/primitive_docs.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index ead1987d04b..b79cfa3eead 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -363,12 +363,12 @@ 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`]. 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 the type has drop glue and memory is not already
-/// initialized---otherwise `drop` would be called on the uninitialized memory.
+/// 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.
@@ -898,7 +898,10 @@ 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, not null, and pointing to valid (initialized) memory.
+/// aligned, not null, and pointing to memory containing a valid value of `T` - for example,
+/// `&bool` can only point to an allocation containing the integer values `1` (`true`) or `0`
+/// (`false`), but the behavior of creating a `&bool` that points to an allocation containing
+/// the value `3` is undefined.
 /// In fact, `Option<&T>` has the same memory representation as a
 /// nullable but aligned pointer, and can be passed across FFI boundaries as such.
 ///