Bad error message with async main

If someone tries to do the following async fn main() -> Result<(), Box<dyn std::error::Error> the error message is not helpful (though it is technically correct).

error[E0277]: `main` has invalid return type `impl futures::Future`
  --> rs/agent-updater/src/main.rs:46:20
   |
46 | async fn main() -> Result<(), Box<dyn std::error::Error>> {
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination`
   |
   = help: consider using `()`, or a `Result`

I think that it should point to the async keyword and say that standard rust does not support async main.

This issue has been assigned to @Nokel81 via this comment.

1 thought on “Bad error message with async main

Comments are closed.