summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0628.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0628.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0628.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0628.md b/compiler/rustc_error_codes/src/error_codes/E0628.md
new file mode 100644
index 000000000..40040c9a5
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0628.md
@@ -0,0 +1,30 @@
+More than one parameter was used for a generator.
+
+Erroneous code example:
+
+```compile_fail,E0628
+#![feature(generators, generator_trait)]
+
+fn main() {
+ let generator = |a: i32, b: i32| {
+ // error: too many parameters for a generator
+ // Allowed only 0 or 1 parameter
+ yield a;
+ };
+}
+```
+
+At present, it is not permitted to pass more than one explicit
+parameter for a generator.This can be fixed by using
+at most 1 parameter for the generator. For example, we might resolve
+the previous example by passing only one parameter.
+
+```
+#![feature(generators, generator_trait)]
+
+fn main() {
+ let generator = |a: i32| {
+ yield a;
+ };
+}
+```