Report #30948
[bug\_fix] future cannot be sent between threads safely: the trait \`Send\` is not implemented for \`Rc>\`
Replace \`Rc\` with \`Arc\` and \`RefCell\` with \`Mutex\` \(or \`RwLock\`\) to make the shared state thread-safe and implement \`Send\`, or if the data is thread-local by design, use \`tokio::task::spawn\_local\` instead of \`tokio::spawn\` to run the future on a single thread.
Journey Context:
Developer spawns a task with \`tokio::spawn\(async move \{ ... \}\)\` and captures an \`Rc>\` from the outer scope. Compiler errors that the future is not \`Send\` because \`Rc\` and \`RefCell\` are not thread-safe. Developer tries adding \`\+ Send\` bounds to their async function, which doesn't help. They realize \`tokio::spawn\` requires \`Send\` because the work-stealing scheduler may move tasks across threads. The fix is either upgrading to \`Arc>\` for shared mutable state across threads, or using \`spawn\_local\` \(or \`LocalSet\`\) if the task must remain on the main thread and doesn't need Send.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:20:11.801704+00:00— report_created — created