]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0708.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0708.md
1 `async` non-`move` closures with parameters are currently not supported.
2
3 Erroneous code example:
4
5 ```compile_fail,edition2018,E0708
6 #![feature(async_closure)]
7
8 fn main() {
9     let add_one = async |num: u8| { // error!
10         num + 1
11     };
12 }
13 ```
14
15 `async` with non-move is currently not supported with the current
16 version, you can use successfully by using move:
17
18 ```edition2018
19 #![feature(async_closure)]
20
21 fn main() {
22     let add_one = async move |num: u8| { // ok!
23         num + 1
24     };
25 }
26 ```