]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0628.md
New upstream version 1.44.1+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0628.md
1 More than one parameter was used for a generator.
2
3 Erroneous code example:
4
5 ```compile_fail,E0628
6 #![feature(generators, generator_trait)]
7
8 fn main() {
9 let generator = |a: i32, b: i32| {
10 // error: too many parameters for a generator
11 // Allowed only 0 or 1 parameter
12 yield a;
13 };
14 }
15 ```
16
17 At present, it is not permitted to pass more than one explicit
18 parameter for a generator.This can be fixed by using
19 at most 1 parameter for the generator. For example, we might resolve
20 the previous example by passing only one parameter.
21
22 ```
23 #![feature(generators, generator_trait)]
24
25 fn main() {
26 let generator = |a: i32| {
27 yield a;
28 };
29 }
30 ```