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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
295 B
Rust
Raw Normal View History

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