# 错误[E0277]：`Rc<RefCell<dyn Trait>>` 无法在线程间安全发送

- **ID:** `rust/e0277-send-not-satisfied-for-rc`
- **领域:** rust
- **类别:** type_error
- **错误码:** `E0277`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Rc 使用非原子引用计数，跨线程使用会导致数据竞争，因此未实现 Send。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| rustc 1.68 | active | — | — |
| rustc 1.75 | active | — | — |
| rustc 1.82 | active | — | — |

## 解决方案

1. ```
   将 Rc 替换为 Arc（原子引用计数），并使用 Arc<Mutex<T>> 或 Arc<RwLock<T>> 实现内部可变性。
   ```
2. ```
   使用 `std::sync::Mutex<RefCell<dyn Trait>>` 或 `parking_lot::Mutex` 如果必须保留 Rc，但推荐使用 Arc。
   ```

## 无效尝试

- **** — Mutex<Arc<RefCell<...>>> adds overhead and doesn't solve the fundamental Rc issue; use Arc instead. (70% 失败率)
- **** — Deriving Clone doesn't change thread safety; the compiler still requires Send on the inner type. (90% 失败率)
