← Rule catalog

rust-doctor · Async

blocking-in-async

Flags blocking `std` calls inside `async fn`: `std::thread::sleep`, `std::fs::*`, `std::net::*`. These block the async runtime's thread pool, reducing concurrency and potentially causing deadlocks.

Severity
error
Confidence
medium
Analyzer
syn-ast
Default policy
Enabled

Tags

  • async
  • heuristic

Framework requirements

No framework requirement.

Limitations

  • The rule recognizes known call names but does not follow aliases or interprocedural calls.

Remediation

Use async equivalents: `tokio::time::sleep`, `tokio::fs::*`, `tokio::net::*`. For CPU-bound work, use `tokio::task::spawn_blocking`.

Fix capability: guidance