about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src/error_codes/E0628.md
blob: d0d387cf6c7ef7a19865c7a52877c43de1aa8cbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
More than one parameter was used for a coroutine.

Erroneous code example:

```compile_fail,E0628
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]

fn main() {
    let coroutine = #[coroutine] |a: i32, b: i32| {
        // error: too many parameters for a coroutine
        // Allowed only 0 or 1 parameter
        yield a;
    };
}
```

At present, it is not permitted to pass more than one explicit
parameter for a coroutine.This can be fixed by using
at most 1 parameter for the coroutine. For example, we might resolve
the previous example by passing only one parameter.

```
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]

fn main() {
    let coroutine = #[coroutine] |a: i32| {
        yield a;
    };
}
```