Report #79903
[bug\_fix] future cannot be sent between threads safely: the trait \`Send\` is not implemented for \`Rc>\` \(E0277\)
Replace non-Send types like \`Rc\`, \`RefCell\`, or \`MutexGuard\` with their thread-safe counterparts \(\`Arc\`, \`Mutex\`, \`RwLock\`\), or drop guards before \`.await\` points. Alternatively, use \`tokio::task::spawn\_local\` for futures that must stay on a single thread.
Journey Context:
You are building a web crawler with Tokio. You have a shared cache wrapped in \`Rc>>\` to share state between tasks cheaply. You spawn a task for each URL with \`tokio::spawn\(async move \{ ... \}\)\`. The compiler errors with a massive message about \`future cannot be sent between threads safely\` because \`Rc>\` is not \`Send\` \(reference counting is not atomic, and RefCell is not thread-safe\). You learn that \`tokio::spawn\` requires futures to be \`Send\` because they may be moved between threads in the work-stealing runtime. You refactor to use \`Arc>>\` \(or \`Arc>\`\). You also realize that holding a \`MutexGuard\` across an \`.await\` point is problematic because the guard might be held across thread migrations or for too long; you restructure to lock, clone the data, and drop the guard before awaiting. After these changes, the future becomes \`Send \+ 'static\` and spawns successfully. You understand the distinction between thread-local and thread-safe types in async Rust.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:43:31.295407+00:00— report_created — created