Skip to content

Add support for Coroutine Closures #3783

Open
@carolynzech

Description

@carolynzech

Requested feature: Add support for coroutine closures
Use case: async closures
Link to relevant documentation (Rust reference, Nomicon, RFC): RFC, Addition to StableMIR

Test case:

(Test taken from https://github.com/rust-lang/rust/blob/master/tests/codegen/async-closure-debug.rs)

fn async_closure_test(upvar: &str) -> impl AsyncFn() + '_ {
    async move || {
        let hello = String::from("hello");
        println!("{hello}, {upvar}");
    }
}

fn main() {
    let _async_closure = async_closure_test("world");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions