-
-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Async function leads to a "more general type" error #71723
Copy link
Copy link
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-type-systemArea: Type systemArea: Type systemAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-type-systemArea: Type systemArea: Type systemAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types 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
- StatusShow more project fieldsIn progress (current sprint)
Rustc complains about a type being more general than the other when testing if the
Futurereturned by anasyncfunction isSend. The same code withoutasyncsugar is accepted by the compiler.This might be related to #60658.
I tried to minimize further, but removing
.flatten(), the boxing with a trait object or even the mapping to an empty stream makes the code compile.Playground
Expected result
It compiles successfully --
is_send(make_future())andis_send(make_future_2())are both accepted by the compiler.Actual result
is_send(make_future_2())is rejected with the following error: