1 error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function
2 --> $DIR/issue-62097.rs:13:13
4 LL | foo(|| self.bar()).await;
5 | ^^ ---- `self` is borrowed here
7 | may outlive borrowed value `self`
9 note: function requires argument type to outlive `'static`
10 --> $DIR/issue-62097.rs:13:9
12 LL | foo(|| self.bar()).await;
14 help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword
16 LL | foo(move || self.bar()).await;
19 error[E0521]: borrowed data escapes outside of associated function
20 --> $DIR/issue-62097.rs:13:9
22 LL | pub async fn run_dummy_fn(&self) {
25 | `self` is a reference that is only valid in the associated function body
26 | let's call the lifetime of this reference `'1`
27 LL | foo(|| self.bar()).await;
30 | `self` escapes the associated function body here
31 | argument requires that `'1` must outlive `'static`
33 error: aborting due to 2 previous errors
35 Some errors have detailed explanations: E0373, E0521.
36 For more information about an error, try `rustc --explain E0373`.