]> git.proxmox.com Git - rustc.git/blob - src/test/ui/async-await/issues/issue-62097.nll.stderr
New upstream version 1.62.1+dfsg1
[rustc.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 | -----
24 | |
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;
28 | ^^^^^^^^^^^^^^^^^^
29 | |
30 | `self` escapes the associated function body here
31 | argument requires that `'1` must outlive `'static`
32
33 error: aborting due to 2 previous errors
34
35 Some errors have detailed explanations: E0373, E0521.
36 For more information about an error, try `rustc --explain E0373`.