File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
- Abstract return types (written ` impl Trait ` for some trait ` Trait ` ) are only
2
- allowed as function and inherent impl return types.
1
+ ` impl Trait ` is only allowed as a function return and argument type.
3
2
4
3
Erroneous code example:
5
4
@@ -14,7 +13,7 @@ fn main() {
14
13
}
15
14
```
16
15
17
- Make sure ` impl Trait ` only appears in return-type position .
16
+ Make sure ` impl Trait ` appears in a function signature .
18
17
19
18
```
20
19
fn count_to_n(n: usize) -> impl Iterator<Item=usize> {
@@ -28,6 +27,6 @@ fn main() {
28
27
}
29
28
```
30
29
31
- See [ RFC 1522 ] for more details.
30
+ See the [ reference ] for more details on ` impl Trait ` .
32
31
33
- [ RFC 1522 ] : https://github.com/ rust-lang/rfcs/blob/master/text/1522-conservative- impl-trait.md
32
+ [ reference ] : https://doc. rust-lang.org/stable/reference/types/ impl-trait.html
You can’t perform that action at this time.
0 commit comments