Closed
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
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitArea: Messages for errors, warnings, and lintsAsync-await issues that have been triaged during a working group meeting.Category: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Done