summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0708.md
blob: 9287fc803d1de792ae03a81c932af0ad217933a1 (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
`async` non-`move` closures with parameters are currently not supported.

Erroneous code example:

```compile_fail,edition2018,E0708
#![feature(async_closure)]

fn main() {
    let add_one = async |num: u8| { // error!
        num + 1
    };
}
```

`async` with non-move is currently not supported with the current
version, you can use successfully by using move:

```edition2018
#![feature(async_closure)]

fn main() {
    let add_one = async move |num: u8| { // ok!
        num + 1
    };
}
```