Skip to content

Types are not mentioned in the enforcer of Iterators in for loop #16043

Closed
@huonw

Description

@huonw
fn main() {
    for _c in 1i {}
}
<anon>:2:15: 2:17 error: `for` loop expression does not implement the `Iterator` trait
<anon>:2     for _c in 1i {}
                       ^~
error: aborting due to previous error

It would be nice if this mentioned the type (e.g. "for loop expression has type int, which does not implement the Iterator trait").

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions