Skip to content

Commit 108a697

Browse files
committed
conversion corrections
1 parent b26958c commit 108a697

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

conversions.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Coercion is allowed between the following types:
5353
* `&mut T` to `*mut T`
5454
* Unsizing: `T` to `U` if `T` implements `CoerceUnsized<U>`
5555

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
5757
for all pointer types (including smart pointers like Box and Rc). Unsize is
5858
only implemented automatically, and enables the following transformations:
5959

@@ -65,7 +65,6 @@ only implemented automatically, and enables the following transformations:
6565
* `Foo` is a struct
6666
* Only the last field has type `T`
6767
* `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>`)
6968

7069
Coercions occur at a *coercion site*. Any location that is explicitly typed
7170
will cause a coercion to its type. If inference is necessary, the coercion will
@@ -106,13 +105,19 @@ fn main() {
106105
^~~
107106
```
108107

108+
109+
110+
109111
# The Dot Operator
110112

111113
The dot operator will perform a lot of magic to convert types. It will perform
112114
auto-referencing, auto-dereferencing, and coercion until types match.
113115

114116
TODO: steal information from http://stackoverflow.com/questions/28519997/what-are-rusts-exact-auto-dereferencing-rules/28552082#28552082
115117

118+
119+
120+
116121
# Casts
117122

118123
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:
171176

172177

173178

179+
180+
174181
# Conversion Traits
175182

176183
TODO?

0 commit comments

Comments
 (0)