-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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; | ||
| ^^^^^^^ | ||
|
||
error[E0521]: borrowed data escapes outside of 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 function body | ||
LL | foo(|| self.bar()).await; | ||
| ^^^^^^^^^^^^^^^^^^ `self` escapes the function body here | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0373`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: cannot infer an appropriate lifetime | ||
--> $DIR/issue-62097.rs:12:31 | ||
| | ||
LL | pub async fn run_dummy_fn(&self) { | ||
| ^^^^^ ...but this borrow... | ||
LL | foo(|| self.bar()).await; | ||
| --- this return type evaluates to the `'static` lifetime... | ||
| | ||
note: ...can't outlive the lifetime `'_` as defined on the method body at 12:31 | ||
--> $DIR/issue-62097.rs:12:31 | ||
| | ||
LL | pub async fn run_dummy_fn(&self) { | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters