error[E0391]: cycle detected when computing type of async fn #78649
Open
Description
I tried this code:
use futures::future::FutureExt;
async fn foo() {
FutureExt::boxed(async {
foo().await;
});
}
I expected it to compile, but it gave the following error:
error[E0391]: cycle detected when computing type of
foo::{{opaque}}#0
edit:
With one minor change, it compiles:
async fn foo() {
Box::new(async {
foo().await;
});
}
There are no rules that would explain why the first should fail when this succeeds.
Metadata
Assignees
Labels
Area: Async & AwaitArea: Messages for errors, warnings, and lintsArea: Type systemAsync-await issues that have been triaged during a working group meeting.Category: This is a bug.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Projects
Status
On deck