{
  "id": "rust/e0119-conflicting-implementations-of-trait",
  "signature": "error[E0119]: conflicting implementations of trait `Trait` for type `Type`",
  "signature_zh": "错误[E0119]: trait `Trait` 对类型 `Type` 的实现冲突",
  "regex": "error\\[E0119\\]: conflicting implementations of trait `[^`]+` for type `[^`]+`",
  "domain": "rust",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Two or more impl blocks provide implementations of the same trait for the same type, or an impl conflicts with a blanket impl.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个或多个 impl 块为同一类型提供了同一 trait 的实现，或者某个实现与 blanket impl 冲突。",
  "versions": [
    {
      "version": "rustc 1.75.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.78.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.80.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If both impls are needed for different purposes, removing one will cause missing trait implementation errors elsewhere.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Rust doesn't have a lint to suppress conflicting impls; it's a fundamental type system error.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the blanket impl covers the wrapper (e.g., impl<T> Trait for T), the conflict persists.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Remove the duplicate impl block. Example: keep only one `impl Trait for MyType`.",
      "success_rate": 0.95,
      "how": "Remove the duplicate impl block. Example: keep only one `impl Trait for MyType`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a newtype pattern to create a distinct type. Example: `struct MyWrapper(MyType);` and implement the trait for MyWrapper.",
      "success_rate": 0.85,
      "how": "Use a newtype pattern to create a distinct type. Example: `struct MyWrapper(MyType);` and implement the trait for MyWrapper.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the conflict is with a blanket impl, add a type constraint or use specialization (if nightly) with `default impl`. Example: `impl<T: std::fmt::Debug> Trait for T { }`.",
      "success_rate": 0.7,
      "how": "If the conflict is with a blanket impl, add a type constraint or use specialization (if nightly) with `default impl`. Example: `impl<T: std::fmt::Debug> Trait for T { }`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Remove the duplicate impl block. Example: keep only one `impl Trait for MyType`.",
    "Use a newtype pattern to create a distinct type. Example: `struct MyWrapper(MyType);` and implement the trait for MyWrapper.",
    "If the conflict is with a blanket impl, add a type constraint or use specialization (if nightly) with `default impl`. Example: `impl<T: std::fmt::Debug> Trait for T { }`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://doc.rust-lang.org/error_codes/E0119.html",
  "official_doc_section": null,
  "error_code": "E0119",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-03-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}