You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: example is of type F, the behavior of Rust prior to adding coroutines
Instead, this happened:
error[E0277]: expected a `Fn()` closure, found `{coroutine-closure@src\main.rs:6:19: 6:32}`
--> src\main.rs:9:10
|
9 | test(example);
| ---- ^^^^^^^ expected an `Fn()` closure, found `{coroutine-closure@src\main.rs:6:19: 6:32}`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `{coroutine-closure@src\main.rs:6:19: 6:32}`
= note: wrap the `{coroutine-closure@src\main.rs:6:19: 6:32}` in a closure with no arguments: `|| { /* code */ }`
This error started happening with the addition of coroutines, the code works on older nightly versions (don't know exactly when it started). My guess is Rust incorrectly converts all async closures into coroutines.
The text was updated successfully, but these errors were encountered:
saethlin
added
T-types
Relevant to the types team, which will review and decide on the PR/issue.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Feb 11, 2024
Rollup merge of rust-lang#120896 - compiler-errors:coro-closure-kind, r=oli-obk
Print kind of coroutine closure
Make sure that we print "async closure" when we have an async closure, rather than calling it generically a ["coroutine-closure"](rust-lang#120361).
Fixesrust-lang#120886
r? oli-obk
I tried this code:
I expected to see this happen: example is of type F, the behavior of Rust prior to adding coroutines
Instead, this happened:
Meta
This error started happening with the addition of coroutines, the code works on older nightly versions (don't know exactly when it started). My guess is Rust incorrectly converts all async closures into coroutines.
The text was updated successfully, but these errors were encountered: