{
  "id": "rust/e0599-no-method-named-iter-found",
  "signature": "error[E0599]: no method named `iter` found for struct `std::collections::HashMap<String, i32>` in the current scope",
  "signature_zh": "错误[E0599]：在当前作用域中，结构体 `std::collections::HashMap<String, i32>` 上没有找到名为 `iter` 的方法",
  "regex": "error\\[E0599\\]: no method named `iter` found for struct `std::collections::HashMap<.*>` in the current scope",
  "domain": "rust",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "HashMap does not have an `iter` method that returns an iterator over items; use `iter()` on references or `into_iter()` for owned iteration.",
  "root_cause_type": "generic",
  "root_cause_zh": "HashMap 没有返回元素迭代器的 `iter` 方法；应对引用使用 `iter()` 或对所有权使用 `into_iter()`。",
  "versions": [
    {
      "version": "rustc 1.58.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.64.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.71.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Iterator is automatically in scope. The issue is that HashMap doesn't have a method named `iter` without the trait bounds being satisfied.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The method exists but is named `into_iter()` for owned HashMap. `iter()` exists on references like `&map`.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Iterator is a trait, not a derive macro. You cannot derive Iterator for HashMap.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use `map.iter()` on a reference: `for (key, value) in &map { ... }` or `let iter = map.iter();`",
      "success_rate": 0.95,
      "how": "Use `map.iter()` on a reference: `for (key, value) in &map { ... }` or `let iter = map.iter();`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `into_iter()` for owned iteration: `for (key, value) in map { ... }`",
      "success_rate": 0.9,
      "how": "Use `into_iter()` for owned iteration: `for (key, value) in map { ... }`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `values()` or `keys()` methods: `for value in map.values() { ... }`",
      "success_rate": 0.85,
      "how": "Use `values()` or `keys()` methods: `for value in map.values() { ... }`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "对引用使用 `map.iter()`：`for (key, value) in &map { ... }` 或 `let iter = map.iter();`",
    "对所有权使用 `into_iter()`：`for (key, value) in map { ... }`",
    "使用 `values()` 或 `keys()` 方法：`for value in map.values() { ... }`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://doc.rust-lang.org/error_codes/E0599.html",
  "official_doc_section": null,
  "error_code": "E0599",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.93,
  "resolvable": "true",
  "first_seen": "2023-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}