← Rule catalog

rust-doctor · Framework

tokio-main-missing

Flags `async fn main()` without `#[tokio::main]` (or equivalent runtime attribute). Without it, the async runtime is not initialized and the program won't compile or will panic.

Severity
error
Confidence
medium
Analyzer
syn-ast
Default policy
Enabled

Tags

  • framework
  • heuristic

Framework requirements

  • tokio >=1,<2Features: macros, rt
  • async-std >=1,<2Features: attributes
  • smol >=1,<3

Limitations

  • Syntactic analysis does not have rustc name resolution or inferred type information.

Remediation

Add `#[tokio::main]` above `async fn main()`.

Fix capability: guidance