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
emits
The note "the
Outputof thisasync fn's found opaque type" is kind of hard to understand. If the return type ofasync_fnisn't explicitly given, it doesn't even point at a type:Perhaps the note should instead look like this:
@rustbot label A-async-await A-diagnostics D-confusing T-compiler