]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/async-await/issues/issue-62097.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / async-await / issues / issue-62097.stderr
index e23277543c66f3b14e5ba4cc5a40b7dd1826d28a..786f621326049b7eb9cf1ccf62e3e8d5d186218a 100644 (file)
@@ -1,17 +1,36 @@
-error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
-  --> $DIR/issue-62097.rs:12:31
+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 |     pub async fn run_dummy_fn(&self) {
-   |                               ^^^^^ this data with an anonymous lifetime `'_`...
 LL |         foo(|| self.bar()).await;
-   |         --- ...is used and required to live as long as `'static` here
+   |             ^^ ---- `self` is borrowed here
+   |             |
+   |             may outlive borrowed value `self`
+   |
+note: function requires argument type to outlive `'static`
+  --> $DIR/issue-62097.rs:13:9
    |
-note: `'static` lifetime requirement introduced by this bound
-  --> $DIR/issue-62097.rs:4:19
+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 |     F: FnOnce() + 'static
-   |                   ^^^^^^^
+LL |         foo(move || self.bar()).await;
+   |             ++++
+
+error[E0521]: borrowed data escapes outside of associated function
+  --> $DIR/issue-62097.rs:13:9
+   |
+LL |     pub async fn run_dummy_fn(&self) {
+   |                               -----
+   |                               |
+   |                               `self` is a reference that is only valid in the associated function body
+   |                               let's call the lifetime of this reference `'1`
+LL |         foo(|| self.bar()).await;
+   |         ^^^^^^^^^^^^^^^^^^
+   |         |
+   |         `self` escapes the associated function body here
+   |         argument requires that `'1` must outlive `'static`
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0759`.
+Some errors have detailed explanations: E0373, E0521.
+For more information about an error, try `rustc --explain E0373`.