rust/tests/ui/async-await/async-borrowck-escaping-closure-error.rs

12 lines
232 B
Rust

//@ edition:2018
#![feature(async_closure)]
fn foo() -> Box<dyn std::future::Future<Output = u32>> {
let x = 0u32;
Box::new((async || x)())
//~^ ERROR cannot return value referencing local variable `x`
}
fn main() {
}