Error codes

E0332: unawaited async fn call

In a terminal: auk explain E0332 prints this page.

On this page

Calling an async fn starts a task. A call whose result is dropped would run unobserved, and its result and errors would be lost, so it must be awaited, stored or returned.

Wrong#

auk
async fn ping(): int = 1
fn main() {
  ping()
  print("done")
}

Fixed#

auk
async fn ping(): int = 1
fn main() {
  let n = await ping()
  print(n)
}

Common causes#

  • Forgetting await on a call made for its side effect.
  • Starting several tasks: store them, then await (a, b) or await tasks.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page