about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-01-29 09:34:49 +0900
committerGitHub <noreply@github.com>2020-01-29 09:34:49 +0900
commit9c1244d6a1949076d1892586a417d9c2f8ec9dfc (patch)
treef2048da25c20ada7106edc1db1c9b31c753fe2e2 /src
parentedfa0f43458af676e6475bacb281564bcf4b0c85 (diff)
parent976a146203a61d2feb9d3304aaaf35b0995d2bc3 (diff)
Rollup merge of #68582 - LeSeulArtichaut:code-explanations, r=Dylan-DPC
Add E0727 long explanation

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

r? @GuillaumeGomez
Diffstat (limited to 'src')
-rw-r--r--src/librustc_error_codes/error_codes.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0727.md26
2 files changed, 27 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index 180ccb15977..c3d9ed08898 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -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"),
@@ -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
 }
diff --git a/src/librustc_error_codes/error_codes/E0727.md b/src/librustc_error_codes/error_codes/E0727.md
new file mode 100644
index 00000000000..528807ee9af
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0727.md
@@ -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;
+};
+```