]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0727.md
New upstream version 1.45.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0727.md
1 A `yield` clause was used in an `async` context.
2
3 Example of erroneous code:
4
5 ```compile_fail,E0727,edition2018
6 #![feature(generators)]
7
8 fn main() {
9 let generator = || {
10 async {
11 yield;
12 }
13 };
14 }
15 ```
16
17 Here, the `yield` keyword is used in an `async` block,
18 which is not yet supported.
19
20 To fix this error, you have to move `yield` out of the `async` block:
21
22 ```edition2018
23 #![feature(generators)]
24
25 fn main() {
26 let generator = || {
27 yield;
28 };
29 }
30 ```