]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-62097.rs
Rollup merge of #103766 - lukas-code:error-in-core, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-62097.rs
1 // edition:2018
2 async fn foo<F>(fun: F)
3 where
4     F: FnOnce() + 'static
5 {
6     fun()
7 }
8
9 struct Struct;
10
11 impl Struct {
12     pub async fn run_dummy_fn(&self) {
13         foo(|| self.bar()).await;
14         //~^ ERROR closure may outlive the current function
15         //~| ERROR borrowed data escapes outside of associated function
16     }
17
18     pub fn bar(&self) {}
19 }
20
21 fn main() {}