@@ -53,7 +53,7 @@ Coercion is allowed between the following types:
53
53
* ` &mut T ` to ` *mut T `
54
54
* Unsizing: ` T ` to ` U ` if ` T ` implements ` CoerceUnsized<U> `
55
55
56
- ` CoerceUnsized<Pointer<U>> for Pointer<T> ` where T: Unsize<U > is implemented
56
+ ` CoerceUnsized<Pointer<U>> for Pointer<T> where T: Unsize<U> ` is implemented
57
57
for all pointer types (including smart pointers like Box and Rc). Unsize is
58
58
only implemented automatically, and enables the following transformations:
59
59
@@ -65,7 +65,6 @@ only implemented automatically, and enables the following transformations:
65
65
* ` Foo ` is a struct
66
66
* Only the last field has type ` T `
67
67
* ` T ` is not part of the type of any other fields
68
- (note that this also applies to to tuples as an anonymous struct ` Tuple3<T, U, V> ` )
69
68
70
69
Coercions occur at a * coercion site* . Any location that is explicitly typed
71
70
will cause a coercion to its type. If inference is necessary, the coercion will
@@ -106,13 +105,19 @@ fn main() {
106
105
^~~
107
106
```
108
107
108
+
109
+
110
+
109
111
# The Dot Operator
110
112
111
113
The dot operator will perform a lot of magic to convert types. It will perform
112
114
auto-referencing, auto-dereferencing, and coercion until types match.
113
115
114
116
TODO: steal information from http://stackoverflow.com/questions/28519997/what-are-rusts-exact-auto-dereferencing-rules/28552082#28552082
115
117
118
+
119
+
120
+
116
121
# Casts
117
122
118
123
Casts are a superset of coercions: every coercion can be explicitly invoked via a
@@ -171,6 +176,8 @@ For numeric casts, there are quite a few cases to consider:
171
176
172
177
173
178
179
+
180
+
174
181
# Conversion Traits
175
182
176
183
TODO?
0 commit comments