Skip to content

Commit 26fdde9

Browse files
committed
Add long error explanation for E0708 #61137
Refactor code as per the suggestions Refacotor code provide edition support
1 parent 2113659 commit 26fdde9

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/librustc_error_codes/error_codes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ E0703: include_str!("./error_codes/E0703.md"),
393393
E0704: include_str!("./error_codes/E0704.md"),
394394
E0705: include_str!("./error_codes/E0705.md"),
395395
E0706: include_str!("./error_codes/E0706.md"),
396+
E0708: include_str!("./error_codes/E0708.md"),
396397
E0710: include_str!("./error_codes/E0710.md"),
397398
E0712: include_str!("./error_codes/E0712.md"),
398399
E0713: include_str!("./error_codes/E0713.md"),
@@ -605,8 +606,6 @@ E0751: include_str!("./error_codes/E0751.md"),
605606
E0696, // `continue` pointing to a labeled block
606607
// E0702, // replaced with a generic attribute input check
607608
// E0707, // multiple elided lifetimes used in arguments of `async fn`
608-
E0708, // `async` non-`move` closures with parameters are not currently
609-
// supported
610609
// E0709, // multiple different lifetimes used in arguments of `async fn`
611610
E0711, // a feature has been declared with conflicting stability attributes
612611
E0717, // rustc_promotable without stability attribute
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
`async` non-`move` closures with parameters are currently not supported.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,edition2018
6+
#![feature(async_closure)]
7+
8+
fn main() {
9+
let add_one = async |num: u8| { // error!
10+
num + 1
11+
};
12+
}
13+
```
14+
15+
`async` with non-move is currently not supported with the current
16+
version, you can use successfully by using move:
17+
18+
```edition2018
19+
#![feature(async_closure)]
20+
21+
fn main() {
22+
let add_one = async move |num: u8| { // ok!
23+
num + 1
24+
};
25+
}
26+
```

src/test/ui/async-await/no-params-non-move-async-closure.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ LL | let _ = async |x: u8| {};
88

99
error: aborting due to previous error
1010

11+
For more information about this error, try `rustc --explain E0708`.

0 commit comments

Comments
 (0)