-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #127827 - compiler-errors:async-closure-closure-async, …
…r=<try> [EXPERIMENT] Rewrite closure-of-async to async-closure to see what the fallout is uwuwuwu
- Loading branch information
Showing
6 changed files
with
111 additions
and
55 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 |
---|---|---|
@@ -1,19 +1,16 @@ | ||
error: captured variable cannot escape `FnMut` closure body | ||
--> $DIR/issue-69446-fnmut-capture.rs:19:17 | ||
error: async closure does not implement `FnMut` because it captures state from its environment | ||
--> $DIR/issue-69446-fnmut-capture.rs:19:9 | ||
| | ||
LL | let mut x = Foo; | ||
| ----- variable defined here | ||
LL | bar(move || async { | ||
| _______________-_^ | ||
| | | | ||
| | inferred to be a `FnMut` closure | ||
LL | | x.foo(); | ||
| | - variable captured here | ||
LL | | }); | ||
| |_____^ returns an `async` block that contains a reference to a captured variable, which then escapes the closure body | ||
LL | bar(move || async { | ||
| --- ^^^^^^^ | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= note: `FnMut` closures only have access to their captured variables while they are executing... | ||
= note: ...therefore, they cannot allow references to captured variables to escape | ||
note: required by a bound in `bar` | ||
--> $DIR/issue-69446-fnmut-capture.rs:12:25 | ||
| | ||
LL | async fn bar<T>(_: impl FnMut() -> T) | ||
| ^^^^^^^^^^^^ required by this bound in `bar` | ||
|
||
error: aborting due to 1 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