2019-10-23 12:28:55 -05:00
|
|
|
error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function
|
|
|
|
--> $DIR/issue-62097.rs:13:13
|
|
|
|
|
|
|
|
|
LL | foo(|| self.bar()).await;
|
|
|
|
| ^^ ---- `self` is borrowed here
|
|
|
|
| |
|
|
|
|
| may outlive borrowed value `self`
|
|
|
|
|
|
|
|
|
note: function requires argument type to outlive `'static`
|
|
|
|
--> $DIR/issue-62097.rs:13:9
|
|
|
|
|
|
|
|
|
LL | foo(|| self.bar()).await;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword
|
|
|
|
|
|
|
|
|
LL | foo(move || self.bar()).await;
|
2021-06-28 13:22:47 -05:00
|
|
|
| ^^^^
|
2019-10-23 12:28:55 -05:00
|
|
|
|
2020-03-04 21:03:15 -06:00
|
|
|
error[E0521]: borrowed data escapes outside of associated function
|
2019-10-23 12:28:55 -05:00
|
|
|
--> $DIR/issue-62097.rs:13:9
|
|
|
|
|
|
|
|
|
LL | pub async fn run_dummy_fn(&self) {
|
2020-03-04 21:03:15 -06:00
|
|
|
| ----- `self` is a reference that is only valid in the associated function body
|
2019-10-23 12:28:55 -05:00
|
|
|
LL | foo(|| self.bar()).await;
|
2020-03-04 21:03:15 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^ `self` escapes the associated function body here
|
2019-10-23 12:28:55 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
2021-02-02 11:57:34 -06:00
|
|
|
Some errors have detailed explanations: E0373, E0521.
|
|
|
|
For more information about an error, try `rustc --explain E0373`.
|