← Rule catalog

rust-doctor · Framework

tokio-spawn-without-move

Flags `tokio::spawn(async { ... })` without the `move` keyword. Without `move`, the spawned task borrows from the enclosing scope, which often fails to compile due to lifetime requirements ('static bound on spawn).

Severity
error
Confidence
medium
Analyzer
syn-ast
Default policy
Enabled

Tags

  • framework
  • heuristic

Framework requirements

  • tokio >=1,<2Features: rt

Limitations

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

Remediation

Use `tokio::spawn(async move { ... })`.

Fix capability: guidance