rust/tests/ui/async-await/issues/issue-62097.rs

22 lines
357 B
Rust
Raw Normal View History

2019-10-23 12:25:05 -05:00
// edition:2018
async fn foo<F>(fun: F)
where
F: FnOnce() + 'static
{
fun()
}
struct Struct;
impl Struct {
2022-05-21 14:46:25 -05:00
pub async fn run_dummy_fn(&self) {
2019-10-23 12:25:05 -05:00
foo(|| self.bar()).await;
2022-04-01 12:13:25 -05:00
//~^ ERROR closure may outlive the current function
//~| ERROR borrowed data escapes outside of method
2019-10-23 12:25:05 -05:00
}
pub fn bar(&self) {}
}
fn main() {}