W3cubDocs

/Rust

Error code E0708

Note: this error code is no longer emitted by the compiler.

async non-move closures with parameters are currently not supported.

Erroneous code example:

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

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

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

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0708.html