{
  "id": "rust/e0599-no-method-found-for-trait-object",
  "signature": "error[E0599]: no method named `foo` found for struct `Box<dyn Trait>` in the current scope",
  "signature_zh": "错误[E0599]：在当前作用域中未找到结构体 `Box<dyn Trait>` 的方法 `foo`",
  "regex": "error\\[E0599\\]: no method named `.*` found for struct `Box<dyn Trait>`",
  "domain": "rust",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The trait object does not expose the method because the trait definition lacks the method or it's not object-safe.",
  "root_cause_type": "generic",
  "root_cause_zh": "trait 对象未暴露该方法，因为 trait 定义中缺少该方法或该方法不是对象安全的。",
  "versions": [
    {
      "version": "rustc 1.70",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.76",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.83",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Methods with generic type parameters are not object-safe; use associated types or dyn-compatible signatures.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The method must exist in the trait; impl Trait only changes dispatch, not method availability.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the method is defined in the trait and is object-safe: no generics, use `where Self: Sized` for non-object-safe methods.",
      "success_rate": 0.9,
      "how": "Ensure the method is defined in the trait and is object-safe: no generics, use `where Self: Sized` for non-object-safe methods.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the method uses generics, refactor to use `Box<dyn Trait>` with a separate trait for object-safe methods.",
      "success_rate": 0.85,
      "how": "If the method uses generics, refactor to use `Box<dyn Trait>` with a separate trait for object-safe methods.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "确保方法在 trait 中定义且是对象安全的：避免泛型，对非对象安全的方法使用 `where Self: Sized`。",
    "如果方法使用泛型，重构为使用 `Box<dyn Trait>` 并分离出对象安全的 trait。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://doc.rust-lang.org/stable/error-index.html#E0599",
  "official_doc_section": null,
  "error_code": "E0599",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-08-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}