]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-62097.nll.stderr
Use multispan suggestions more often
[rust.git] / src / test / ui / async-await / issues / issue-62097.nll.stderr
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
3    |
4 LL |         foo(|| self.bar()).await;
5    |             ^^ ---- `self` is borrowed here
6    |             |
7    |             may outlive borrowed value `self`
8    |
9 note: function requires argument type to outlive `'static`
10   --> $DIR/issue-62097.rs:13:9
11    |
12 LL |         foo(|| self.bar()).await;
13    |         ^^^^^^^^^^^^^^^^^^
14 help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword
15    |
16 LL |         foo(move || self.bar()).await;
17    |             ^^^^
18
19 error[E0521]: borrowed data escapes outside of associated function
20   --> $DIR/issue-62097.rs:13:9
21    |
22 LL |     pub async fn run_dummy_fn(&self) {
23    |                               ----- `self` is a reference that is only valid in the associated function body
24 LL |         foo(|| self.bar()).await;
25    |         ^^^^^^^^^^^^^^^^^^ `self` escapes the associated function body here
26
27 error: aborting due to 2 previous errors
28
29 Some errors have detailed explanations: E0373, E0521.
30 For more information about an error, try `rustc --explain E0373`.