Closed
Description
Given the following code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=0db76b4ce2ff53636126640d313e2b91
fn main() {
bar();
}
async fn bar() {
a_mod::foo().await;
}
mod a_mod {
pub fn foo() {}
}
The current output is:
error[E0277]: `()` is not a future
--> a.rs:6:17
|
6 | a_mod::foo().await;
| ------------^^^^^^ `()` is not a future
| |
| this call returns `()`
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
= note: required because of the requirements on the impl of `IntoFuture` for `()`
help: remove the `.await`
|
6 - a_mod::foo().await;
6 + a_mod::foo();
|
help: alternatively, consider making `fn foo` asynchronous
|
10| async pub fn foo() {}
| +++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
Ideally the output should look like:
...
10| pub async fn foo() {}
| +++++
...
Tested on rustc 1.60.0 stable and nightly-2022-04-29