Report #17620
[bug\_fix] the trait bound \`dyn Future \+ Send: Send\` is not satisfied in \`spawn\` \(E0277\)
Ensure all types held across await points are \`Send\`. Replace \`Rc\` with \`Arc\`, replace \`std::sync::Mutex\` with \`tokio::sync::Mutex\` \(since the standard library's \`MutexGuard\` is not \`Send\` on some platforms\), and ensure no references to stack variables are held across await points.
Journey Context:
Developer writes an async function using \`tokio\`, calls \`tokio::spawn\` to run it in the background. The compiler fails with an error stating the future is not \`Send\`. The error points to a captured variable inside the async block, often an \`Rc\` or a \`std::sync::MutexGuard\`. Developer learns that Tokio's work-stealing runtime requires tasks to be \`Send\` so they can be moved between threads. They try adding \`\+ Send\` bounds to generic functions, which doesn't solve the root cause. Realizing \`Rc\` uses non-atomic reference counting \(not thread-safe\), they switch to \`Arc\`. The error persists because they are holding a \`std::sync::MutexGuard\` across an await point; they learn this guard is not \`Send\` on some platforms \(like macOS\). They switch to \`tokio::sync::Mutex\`, whose guard is \`Send\`. The task now compiles.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:51:52.509811+00:00— report_created — created