Commit 79e0589 1 parent 8983dcc commit 79e0589 Copy full SHA for 79e0589
File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -46,25 +46,25 @@ sites are:
46
46
For example, ` &mut 42 ` is coerced to have type ` &i8 ` in the following:
47
47
48
48
``` rust
49
- struct Foo { x : & i8 }
49
+ struct Foo <' a > { x : & ' a i8 }
50
50
51
51
fn main () {
52
52
Foo { x : & mut 42 };
53
53
}
54
54
```
55
55
56
- (Note that lifetime specifiers on ` struct Foo ` have been omitted for brevity.)
57
-
58
56
* Function results&ndash ; either the final line of a block if it is not
59
57
semicolon-terminated or any expression in a ` return ` statement
60
58
61
59
For example, ` x ` is coerced to have type ` &dyn Display ` in the following:
62
60
63
61
``` rust
62
+ use std :: fmt :: Display ;
64
63
fn foo (x : & u32 ) -> & dyn Display {
65
64
x
66
65
}
67
66
```
67
+
68
68
* The [ as] type cast operator can also explicitly perform type coersion.
69
69
70
70
@@ -187,7 +187,7 @@ unsized coercion to `Foo<U>`.
187
187
188
188
[ RFC 401 ] : https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
189
189
[ RFC 1558 ] : https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md
190
- [ subtype ] : subtyping.html`
191
- [ as ] : operator-expr.html #type-cast-expressions`
190
+ [ subtype ] : subtyping.md
191
+ [ as ] : expressions/ operator-expr.md #type-cast-expressions
192
192
[ `Unsize` ] : ../std/marker/trait.Unsize.html
193
193
[ `CoerceUnsized` ] : ../std/ops/trait.CoerceUnsized.html
You can’t perform that action at this time.
0 commit comments