-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsAsyncAwait-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-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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.
Description
fn foo() -> u8 {
async fn async_fn() -> () {}
async_fn()
}
emits
error[E0308]: mismatched types
--> src/lib.rs:4:5
|
1 | fn foo() -> u8 {
| -- expected `u8` because of return type
2 | async fn async_fn() -> () {}
| -- the `Output` of this `async fn`'s found opaque type
3 |
4 | async_fn()
| ^^^^^^^^^^ expected `u8`, found opaque type
|
= note: expected type `u8`
found opaque type `impl Future`
The note "the Output
of this async fn
's found opaque type" is kind of hard to understand. If the return type of async_fn
isn't explicitly given, it doesn't even point at a type:
2 | async fn async_fn() {}
| - the `Output` of this `async fn`'s found opaque type
Perhaps the note should instead look like this:
2 | async fn async_fn() {}
| ----- the found opaque type is the `impl Future` returned by this `async fn`
@rustbot label A-async-await A-diagnostics D-confusing T-compiler
henryboisdequin and jimouris
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsAsyncAwait-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-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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.
Type
Projects
Status
Done
Milestone
Relationships
Development
Select code repository
Activity
nellshamrell commentedon Jan 10, 2021
Looks like #66463 touched areas of code that are relevant to this issue (not to say that it caused the issue, only that it provides a potential pointer to the parts of the code related to generating this error message)
tmandry commentedon Jan 28, 2021
@nellshamrell Are you still planning to work on this? If not no worries, feel free to release your assignment.
Rollup merge of rust-lang#82165 - nellshamrell:nell/fix-80658-B, r=es…
Rollup merge of rust-lang#82165 - nellshamrell:nell/fix-80658-B, r=es…
Rollup merge of rust-lang#82165 - nellshamrell:nell/fix-80658-B, r=es…
henryboisdequin commentedon Mar 11, 2021
Can't this issue be closed (#82165) or is there still more work to be done?
22 remaining items
nellshamrell commentedon Jun 29, 2021
I've opened a PR with at least a partial fix for this issue: #86705
eholk commentedon Nov 21, 2022
Is this still an issue?
The current output for the test case (playground) is:
which looks pretty close to the desired output listed above.
vincenzopalazzo commentedon Dec 8, 2022
@rustbot claim
I will take a look as discussed in one of the async team meeting
fix: improve the suggestion on future not awaited
Rollup merge of rust-lang#107902 - vincenzopalazzo:macros/async_fn_su…