Skip to content

Forgetting .iter() in for loop causes confusing type error message #8649

Closed
@catamorphism

Description

@catamorphism

I accidentally wrote:

for p in foo() { ... }

where foo returns a vector. The error:

search.rs:31:4: 37:8 error: type `&mut ~[std::path::PosixPath]` does not implement any method in scope named `next`

was not exactly useful. The problem was that I left out the .iter() after foo(). But my first instinct would be to look for where I'm calling next(), and I'm not calling it explicitly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemP-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions