about summary refs log tree commit diff
path: root/tests/ui/async-await/async-borrowck-escaping-closure-error.rs
blob: c02bac2d7dd49e9ee907dc1ab59a2fba1fc76332 (plain)
1
2
3
4
5
6
7
8
9
10
11
// edition:2018

#![feature(async_closure)]
fn foo() -> Box<dyn std::future::Future<Output = u32>> {
    let x = 0u32;
    Box::new((async || x)())
    //~^ ERROR closure may outlive the current function, but it borrows `x`, which is owned by the current function
}

fn main() {
}