|
3 | 3 | /// In addition to being used for explicit dereferencing operations with the
|
4 | 4 | /// (unary) `*` operator in immutable contexts, `Deref` is also used implicitly
|
5 | 5 | /// by the compiler in many circumstances. This mechanism is called
|
6 |
| -/// ['`Deref` coercion'][coercion]. In mutable contexts, [`DerefMut`] is used and |
| 6 | +/// ["`Deref` coercion"][coercion]. In mutable contexts, [`DerefMut`] is used and |
7 | 7 | /// mutable deref coercion similarly occurs.
|
8 | 8 | ///
|
9 | 9 | /// **Warning:** Deref coercion is a powerful language feature which has
|
10 | 10 | /// far-reaching implications for every type that implements `Deref`. The
|
11 | 11 | /// compiler will silently insert calls to `Deref::deref`. For this reason, one
|
12 | 12 | /// should be careful about implementing `Deref` and only do so when deref
|
13 | 13 | /// coercion is desirable. See [below][implementing] for advice on when this is
|
14 |
| -/// typeically desired or undesirable. |
| 14 | +/// typically desirable or undesirable. |
15 | 15 | ///
|
16 | 16 | /// Types that implement `Deref` or `DerefMut` are often called "smart
|
17 | 17 | /// pointers" and the mechanism of deref coercion has been specifically designed
|
|
25 | 25 | /// If `T` implements `Deref<Target = U>`, and `v` is a value of type `T`, then:
|
26 | 26 | ///
|
27 | 27 | /// * In immutable contexts, `*v` (where `T` is neither a reference nor a raw
|
28 |
| -/// pointer) is equivalent to `*Deref::deref(&x)`. |
| 28 | +/// pointer) is equivalent to `*Deref::deref(&v)`. |
29 | 29 | /// * Values of type `&T` are coerced to values of type `&U`
|
30 | 30 | /// * `T` implicitly implements all the methods of the type `U` which take the
|
31 | 31 | /// `&self` receiver.
|
|
96 | 96 | /// [string]: ../../alloc/string/struct.String.html
|
97 | 97 | /// [rc]: ../../alloc/rc/struct.Rc.html
|
98 | 98 | /// [cow]: ../../alloc/borrow/enum.Cow.html
|
99 |
| -/// [borrow]: core::borrow::Borrow |
100 | 99 | ///
|
101 | 100 | /// # Examples
|
102 | 101 | ///
|
|
0 commit comments