fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[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 3 | 4LL | foo(|| self.bar()).await; 5 | ^^ ---- `self` is borrowed here 6 | | 7 | may outlive borrowed value `self` 8 | 9note: function requires argument type to outlive `'static` 10 --> $DIR/issue-62097.rs:13:9 11 | 12LL | foo(|| self.bar()).await; 13 | ^^^^^^^^^^^^^^^^^^ 14help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword 15 | 16LL | foo(move || self.bar()).await; 17 | ++++ 18 19error[E0521]: borrowed data escapes outside of method 20 --> $DIR/issue-62097.rs:13:9 21 | 22LL | pub async fn run_dummy_fn(&self) { 23 | ----- 24 | | 25 | `self` is a reference that is only valid in the method body 26 | let's call the lifetime of this reference `'1` 27LL | foo(|| self.bar()).await; 28 | ^^^^^^^^^^^^^^^^^^ 29 | | 30 | `self` escapes the method body here 31 | argument requires that `'1` must outlive `'static` 32 33error: aborting due to 2 previous errors 34 35Some errors have detailed explanations: E0373, E0521. 36For more information about an error, try `rustc --explain E0373`.