Skip to content

Commit

Permalink
Rollup merge of rust-lang#68582 - LeSeulArtichaut:code-explanations, …
Browse files Browse the repository at this point in the history
…r=Dylan-DPC

Add E0727 long explanation

Add long explanation for the `E0727` error code (async generators not yet supported).
Part of rust-lang#61137

r? @GuillaumeGomez
  • Loading branch information
JohnTitor authored Jan 29, 2020
2 parents edfa0f4 + 976a146 commit 9c1244d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ E0718: include_str!("./error_codes/E0718.md"),
E0720: include_str!("./error_codes/E0720.md"),
E0723: include_str!("./error_codes/E0723.md"),
E0725: include_str!("./error_codes/E0725.md"),
E0727: include_str!("./error_codes/E0727.md"),
E0728: include_str!("./error_codes/E0728.md"),
E0729: include_str!("./error_codes/E0729.md"),
E0730: include_str!("./error_codes/E0730.md"),
Expand Down Expand Up @@ -607,6 +608,5 @@ E0746: include_str!("./error_codes/E0746.md"),
E0722, // Malformed `#[optimize]` attribute
E0724, // `#[ffi_returns_twice]` is only allowed in foreign functions
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
E0727, // `async` generators are not yet supported
E0739, // invalid track_caller application/syntax
}
26 changes: 26 additions & 0 deletions src/librustc_error_codes/error_codes/E0727.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
A `yield` clause was used in an `async` context.

Example of erroneous code:

```compile_fail
#![feature(generators)]
let generator = || {
async {
yield;
}
};
```

Here, the `yield` keyword is used in an `async` block,
which is not yet supported.

To fix this error, you have to move `yield` out of the `async` block:

```
#![feature(generators)]
let generator = || {
yield;
};
```

0 comments on commit 9c1244d

Please sign in to comment.