File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
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
You can’t perform that action at this time.
0 commit comments