Report #65246
[bug\_fix] the trait bound \`std::rc::Rc<...>: Send\` is not satisfied
Replace \`Rc\` with \`Arc\` \(atomic reference counting\) for the shared ownership pointer. If interior mutability is required, also replace \`RefCell\` with \`Mutex\` or \`RwLock\`. Root cause: \`Rc\` uses non-atomic operations for reference counting that are not thread-safe \(data races possible\). The \`Send\` trait marks types safe to transfer to another thread; \`Sync\` marks types safe to share references across threads \(\`T: Sync\` means \`&T: Send\`\). \`Rc\` is neither \`Send\` nor \`Sync\`, while \`Arc\` implements both using atomic operations.
Journey Context:
Developer prototypes single-threaded code using \`Rc>\` to share mutable state between multiple owners. After confirming functionality, they attempt to parallelize using \`std::thread::spawn\` or \`tokio::task::spawn\`, moving the \`Rc\` into the closure. The compiler errors with 'the trait bound \`Rc: Send\` is not satisfied'. The developer tries to add \`\+ Send\` bounds or wrap in \`Mutex\`, but the error persists because \`Rc\` itself is not \`Send\`. They search and find Rust documentation explaining that \`Rc\` is for single-threaded scenarios only. They replace \`Rc\` with \`Arc\` \(atomic reference counting\), but if they also used \`RefCell\`, they get another error that \`RefCell\` is not \`Sync\`/\`Send\` across threads. They finally replace the combination with \`Arc>\` or \`Arc>\`, which provides both thread-safe reference counting and thread-safe interior mutability. The code compiles and runs correctly in parallel.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:00:04.346089+00:00— report_created — created