summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/issues/issue-62097.rs
blob: 13c72abb136393521784c5295edde3d89f8800ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// edition:2018
async fn foo<F>(fun: F)
where
    F: FnOnce() + 'static
{
    fun()
}

struct Struct;

impl Struct {
    pub async fn run_dummy_fn(&self) {
        foo(|| self.bar()).await;
        //~^ ERROR closure may outlive the current function
        //~| ERROR borrowed data escapes outside of method
    }

    pub fn bar(&self) {}
}

fn main() {}