summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0727.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0727.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0727.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0727.md b/compiler/rustc_error_codes/src/error_codes/E0727.md
new file mode 100644
index 000000000..386daea0c
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0727.md
@@ -0,0 +1,30 @@
+A `yield` clause was used in an `async` context.
+
+Erroneous code example:
+
+```compile_fail,E0727,edition2018
+#![feature(generators)]
+
+fn main() {
+ 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:
+
+```edition2018
+#![feature(generators)]
+
+fn main() {
+ let generator = || {
+ yield;
+ };
+}
+```