Report #46518
[bug\_fix] error: 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\` \(e.g., \`Arc>\` instead of \`Rc>\`\), ensuring all data held across \`.await\` points is \`Send\`. The root cause is that \`tokio::spawn\` requires the future to be \`Send\` so it can be moved between threads in the work-stealing runtime, but \`Rc\` and \`RefCell\` are not thread-safe.
Journey Context:
Developer is building an async web server with Tokio. They spawn tasks using \`tokio::spawn\` to handle requests concurrently. They use \`Rc>>\` to share mutable state between tasks, thinking it's fine because they read that async Rust allows shared state. The compiler throws the Send error, pointing at the Rc. Developer tries wrapping it in an Arc but keeps the RefCell, which still fails because RefCell isn't Send either. They read the Tokio documentation on spawning and realize that spawned tasks may run on different threads, so all data must be thread-safe \(Send\). They refactor to \`Arc>>\` or \`Arc>\`, which satisfies the Send bound.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:33:12.795792+00:00— report_created — created