{ "$message_type": "diagnostic", "message": "cannot find type `Iter` in this scope", "code": { "code": "E0412", "explanation": "A used type name is not in scope. Erroneous code examples: ```compile_fail,E0412 impl Something {} // error: type name `Something` is not in scope // or: trait Foo { fn bar(N); // error: type name `N` is not in scope } // or: fn foo(x: T) {} // type name `T` is not in scope ``` To fix this error, please verify you didn't misspell the type name, you did declare it or imported it into the scope. Examples: ``` struct Something; impl Something {} // ok! // or: trait Foo { type N; fn bar(_: Self::N); // ok! } // or: fn foo(x: T) {} // ok! ``` Another case that causes this error is when a type is imported into a parent module. To fix this, you can follow the suggestion and use File directly or `use super::File;` which will import the types from the parent namespace. An example that causes this error is below: ```compile_fail,E0412 use std::fs::File; mod foo { fn some_function(f: File) {} } ``` ``` use std::fs::File; mod foo { // either use super::File; // or // use std::fs::File; fn foo(f: File) {} } # fn main() {} // don't insert it for us; that'll break imports ``` " }, "level": "error", "spans": [ { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 564, "byte_end": 568, "line_start": 12, "line_end": 12, "column_start": 12, "column_end": 16, "is_primary": true, "text": [ { "text": " let x: Iter;", "highlight_start": 12, "highlight_end": 16 } ], "label": "not found in this scope", "suggested_replacement": null, "suggestion_applicability": null, "expansion": null } ], "children": [ { "message": "consider importing one of these structs", "code": null, "level": "help", "spans": [ { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::binary_heap::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::btree_map::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::btree_set::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::hash_map::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::hash_set::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::linked_list::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::collections::vec_deque::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::option::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::path::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::result::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::slice::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::sync::mpmc::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null }, { "file_name": "$DIR/use_suggestion_json.rs", "byte_start": 541, "byte_end": 541, "line_start": 11, "line_end": 11, "column_start": 1, "column_end": 1, "is_primary": true, "text": [ { "text": "fn main() {", "highlight_start": 1, "highlight_end": 1 } ], "label": null, "suggested_replacement": "use std::sync::mpsc::Iter; ", "suggestion_applicability": "MaybeIncorrect", "expansion": null } ], "children": [], "rendered": null } ], "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `Iter` in this scope\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0m$DIR/use_suggestion_json.rs:12:12\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let x: Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider importing one of these structs\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ use std::collections::binary_heap::Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ use std::collections::btree_map::Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ use std::collections::btree_set::Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ use std::collections::hash_map::Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m and 9 other candidates\u001b[0m " } { "$message_type": "diagnostic", "message": "aborting due to 1 previous error", "code": null, "level": "error", "spans": [], "children": [], "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to 1 previous error\u001b[0m " } { "$message_type": "diagnostic", "message": "For more information about this error, try `rustc --explain E0412`.", "code": null, "level": "failure-note", "spans": [], "children": [], "rendered": "\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0412`.\u001b[0m " }