]> git.proxmox.com Git - rustc.git/blame - src/test/ui/async-await/issues/issue-62097.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / async-await / issues / issue-62097.rs
CommitLineData
60c5eb7d
XL
1// edition:2018
2async fn foo<F>(fun: F)
3where
4 F: FnOnce() + 'static
5{
6 fun()
7}
8
9struct Struct;
10
11impl Struct {
923072b8 12 pub async fn run_dummy_fn(&self) {
60c5eb7d 13 foo(|| self.bar()).await;
923072b8
FG
14 //~^ ERROR closure may outlive the current function
15 //~| ERROR borrowed data escapes outside of associated function
60c5eb7d
XL
16 }
17
18 pub fn bar(&self) {}
19}
20
21fn main() {}