|
3 | 3 | #[doc(alias = "false")]
|
4 | 4 | /// The boolean type.
|
5 | 5 | ///
|
6 |
| -/// The `bool` represents a value, which could only be either `true` or `false`. If you cast |
7 |
| -/// a `bool` into an integer, `true` will be 1 and `false` will be 0. |
| 6 | +/// The `bool` represents a value, which could only be either [`true`] or [`false`]. If you cast |
| 7 | +/// a `bool` into an integer, [`true`] will be 1 and [`false`] will be 0. |
8 | 8 | ///
|
9 | 9 | /// # Basic usage
|
10 | 10 | ///
|
11 | 11 | /// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
|
12 | 12 | /// which allow us to perform boolean operations using `&`, `|` and `!`.
|
13 | 13 | ///
|
14 |
| -/// `if` requires a `bool` value as its conditional. [`assert!`], which is an |
15 |
| -/// important macro in testing, checks whether an expression is `true` and panics |
| 14 | +/// [`if`] requires a `bool` value as its conditional. [`assert!`], which is an |
| 15 | +/// important macro in testing, checks whether an expression is [`true`] and panics |
16 | 16 | /// if it isn't.
|
17 | 17 | ///
|
18 | 18 | /// ```
|
19 | 19 | /// let bool_val = true & false | false;
|
20 | 20 | /// assert!(!bool_val);
|
21 | 21 | /// ```
|
22 | 22 | ///
|
| 23 | +/// [`true`]: keyword.true.html |
| 24 | +/// [`false`]: keyword.false.html |
23 | 25 | /// [`BitAnd`]: ops::BitAnd
|
24 | 26 | /// [`BitOr`]: ops::BitOr
|
25 | 27 | /// [`Not`]: ops::Not
|
| 28 | +/// [`if`]: keyword.if.html |
26 | 29 | ///
|
27 | 30 | /// # Examples
|
28 | 31 | ///
|
@@ -574,8 +577,8 @@ mod prim_pointer {}
|
574 | 577 | ///
|
575 | 578 | /// # Editions
|
576 | 579 | ///
|
577 |
| -/// Prior to Rust 1.53, arrays did not implement `IntoIterator` by value, so the method call |
578 |
| -/// `array.into_iter()` auto-referenced into a slice iterator. Right now, the old behavior |
| 580 | +/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call |
| 581 | +/// `array.into_iter()` auto-referenced into a [slice iterator](slice::iter). Right now, the old behavior |
579 | 582 | /// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
|
580 | 583 | /// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition
|
581 | 584 | /// might be made consistent to the behavior of later editions.
|
@@ -833,7 +836,7 @@ mod prim_str {}
|
833 | 836 | /// ```
|
834 | 837 | ///
|
835 | 838 | /// The sequential nature of the tuple applies to its implementations of various
|
836 |
| -/// traits. For example, in `PartialOrd` and `Ord`, the elements are compared |
| 839 | +/// traits. For example, in [`PartialOrd`] and [`Ord`], the elements are compared |
837 | 840 | /// sequentially until the first non-equal set is found.
|
838 | 841 | ///
|
839 | 842 | /// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type).
|
@@ -1037,14 +1040,16 @@ mod prim_usize {}
|
1037 | 1040 | /// References, both shared and mutable.
|
1038 | 1041 | ///
|
1039 | 1042 | /// A reference represents a borrow of some owned value. You can get one by using the `&` or `&mut`
|
1040 |
| -/// operators on a value, or by using a `ref` or `ref mut` pattern. |
| 1043 | +/// operators on a value, or by using a [`ref`](keyword.ref.html) or |
| 1044 | +/// <code>[ref](keyword.ref.html) [mut](keyword.mut.html)</code> pattern. |
1041 | 1045 | ///
|
1042 | 1046 | /// For those familiar with pointers, a reference is just a pointer that is assumed to be
|
1043 | 1047 | /// aligned, not null, and pointing to memory containing a valid value of `T` - for example,
|
1044 |
| -/// `&bool` can only point to an allocation containing the integer values `1` (`true`) or `0` |
1045 |
| -/// (`false`), but creating a `&bool` that points to an allocation containing |
1046 |
| -/// the value `3` causes undefined behaviour. |
1047 |
| -/// In fact, `Option<&T>` has the same memory representation as a |
| 1048 | +/// <code>&[bool]</code> can only point to an allocation containing the integer values `1` |
| 1049 | +/// ([`true`](keyword.true.html)) or `0` ([`false`](keyword.false.html)), but creating a |
| 1050 | +/// <code>&[bool]</code> that points to an allocation containing the value `3` causes |
| 1051 | +/// undefined behaviour. |
| 1052 | +/// In fact, <code>[Option]\<&T></code> has the same memory representation as a |
1048 | 1053 | /// nullable but aligned pointer, and can be passed across FFI boundaries as such.
|
1049 | 1054 | ///
|
1050 | 1055 | /// In most cases, references can be used much like the original value. Field access, method
|
@@ -1140,7 +1145,7 @@ mod prim_usize {}
|
1140 | 1145 | /// * [`ExactSizeIterator`]
|
1141 | 1146 | /// * [`FusedIterator`]
|
1142 | 1147 | /// * [`TrustedLen`]
|
1143 |
| -/// * [`Send`] \(note that `&T` references only get `Send` if `T: Sync`) |
| 1148 | +/// * [`Send`] \(note that `&T` references only get `Send` if <code>T: [Sync]</code>) |
1144 | 1149 | /// * [`io::Write`]
|
1145 | 1150 | /// * [`Read`]
|
1146 | 1151 | /// * [`Seek`]
|
@@ -1172,7 +1177,8 @@ mod prim_ref {}
|
1172 | 1177 | /// Function pointers are pointers that point to *code*, not data. They can be called
|
1173 | 1178 | /// just like functions. Like references, function pointers are, among other things, assumed to
|
1174 | 1179 | /// not be null, so if you want to pass a function pointer over FFI and be able to accommodate null
|
1175 |
| -/// pointers, make your type `Option<fn()>` with your required signature. |
| 1180 | +/// pointers, make your type [`Option<fn()>`](core::option#options-and-pointers-nullable-pointers) |
| 1181 | +/// with your required signature. |
1176 | 1182 | ///
|
1177 | 1183 | /// ### Safety
|
1178 | 1184 | ///
|
|
0 commit comments