# 错误[E0277]：`std::rc::Rc<()>` 无法在线程间安全发送

`Rc<()>` 不是 `Send` 的，因为 `Rc` 不是 `Send` 的

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

## 根因

在需要实现 `Send` 的异步块或 future 中使用了 `Rc`，通常在使用 `tokio::spawn` 生成任务时发生。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| rustc 1.75 | active | — | — |
| tokio 1.35 | active | — | — |

## 解决方案

1. ```
   将 `Rc` 替换为 `Arc`（原子引用计数），并将 `RefCell` 替换为 `Mutex` 或 `RwLock`。
   ```
2. ```
   使用 `tokio::task::LocalSet` 在当前线程上生成非 Send 的 future，如果你必须保留 `Rc`。
   ```

## 无效尝试

- **** — `Mutex<Rc>` still doesn't make `Rc` `Send`; `Rc` is fundamentally not thread-safe. You need `Arc` instead. (75% 失败率)
- **** — Unsafe to implement `Send` for `Rc`; leads to data races and undefined behavior. (90% 失败率)
