-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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
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.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.