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

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

22 lines
358 B
Rust
Raw Normal View History

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