Unhelpful span in async type inference error · Issue #62382 · rust-lang/rust (original) (raw)
The following snippet (playground):
#![feature(async_await)]
use std::future::Future;
fn get_future() -> impl Future<Output = ()> { panic!() }
async fn foo() { let a; get_future().await; }
fn main() {}
Gives the following error message:
error[E0698]: type inside `async` object must be known in this context
--> infer_error.rs:11:5
|
11 | get_future().await;
| ^^^^^^^^^^^^^^^^^^ cannot infer type
|
note: the type is part of the `async` object because of this `await`
--> infer_error.rs:11:5
|
11 | get_future().await;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
This error is due to the unknown type of a
. However, nothing in the span indicates that this is the case, making it extremely unclear what the proper fix is.