{
  "id": "rust/e0277-trait-bound-send-not-satisfied-for-rc",
  "signature": "error[E0277]: `Rc<dyn Trait>` cannot be sent between threads safely",
  "signature_zh": "错误[E0277]：`Rc<dyn Trait>` 无法在线程间安全发送",
  "regex": "error\\[E0277\\]: `Rc<dyn \\w+>` cannot be sent between threads safely",
  "domain": "rust",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Rc is not Send because it uses reference counting without atomic operations, making it unsafe to share across threads.",
  "root_cause_type": "generic",
  "root_cause_zh": "Rc 使用非原子引用计数，无法在线程间安全共享，因此未实现 Send trait。",
  "versions": [
    {
      "version": "Rust 1.75.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Rust 1.80.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Rust nightly 2024-01-01",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Wrap Rc in a Mutex: `Mutex<Rc<dyn Trait>>`",
      "why_fails": "Mutex only provides interior mutability, not Send. Rc still prevents Send because the reference count isn't atomic.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add `unsafe impl Send for MyType` manually",
      "why_fails": "Unsafe impl can cause data races and undefined behavior if Rc is actually used across threads; the compiler warning is legitimate.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Replace `Rc<dyn Trait>` with `Arc<dyn Trait>` which uses atomic reference counting and implements Send",
      "success_rate": 0.95,
      "how": "Replace `Rc<dyn Trait>` with `Arc<dyn Trait>` which uses atomic reference counting and implements Send",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `std::sync::Mutex<Box<dyn Trait>>` if you need mutable access from multiple threads",
      "success_rate": 0.85,
      "how": "Use `std::sync::Mutex<Box<dyn Trait>>` if you need mutable access from multiple threads",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Replace `Rc<dyn Trait>` with `Arc<dyn Trait>` which uses atomic reference counting and implements Send",
    "Use `std::sync::Mutex<Box<dyn Trait>>` if you need mutable access from multiple threads"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://doc.rust-lang.org/stable/error_codes/E0277.html",
  "official_doc_section": null,
  "error_code": "E0277",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-02-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}