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

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

## 根因

Rc 使用非原子引用计数，无法在线程间安全共享，因此未实现 Send trait。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Rust 1.75.0 | active | — | — |
| Rust 1.80.0 | active | — | — |
| Rust nightly 2024-01-01 | active | — | — |

## 解决方案

1. ```
   Replace `Rc<dyn Trait>` with `Arc<dyn Trait>` which uses atomic reference counting and implements Send
   ```
2. ```
   Use `std::sync::Mutex<Box<dyn Trait>>` if you need mutable access from multiple threads
   ```

## 无效尝试

- **Wrap Rc in a Mutex: `Mutex<Rc<dyn Trait>>`** — Mutex only provides interior mutability, not Send. Rc still prevents Send because the reference count isn't atomic. (90% 失败率)
- **Add `unsafe impl Send for MyType` manually** — Unsafe impl can cause data races and undefined behavior if Rc is actually used across threads; the compiler warning is legitimate. (95% 失败率)
