Report #84024
[bug\_fix] future cannot be sent between threads safely
Replace non-Send types like \`Rc\`, \`RefCell\`, or raw pointers with their thread-safe equivalents \(\`Arc\` for reference counting, \`Mutex\` or \`RwLock\` for interior mutability\), or use \`tokio::task::spawn\_local\` for tasks that must remain on a single thread.
Journey Context:
A developer using Tokio writes an async function that uses \`Rc>\` to share state. They attempt to spawn this future onto the Tokio runtime with \`tokio::spawn\`. The compiler errors that the future cannot be sent between threads safely because \`Rc>\` is not Send. The developer initially tries to add \`\+ Send\` bounds to their async blocks, which fails. They then learn about the \`Send\` marker trait and why \`Rc\` is not Send \(it lacks atomic reference counting\). They replace \`Rc\` with \`Arc\` and \`RefCell\` with \`tokio::sync::Mutex\` \(or std::sync::Mutex\), making the future Send-safe. Alternatively, they discover \`spawn\_local\` for scenarios where thread-local execution is acceptable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:37:37.228101+00:00— report_created — created