Skip to content

iterator mutations fail to typecheck if the loop argument is not exactly an Iterator #144

Description

@bblum
pub fn count_to_five() -> usize {
    let xs = vec![true, false, true, false, true];
    let mut i = 0;
    for _x in xs {
        i += 1;
    }
    i
}

compiles normally, but with #[mutate], fails with:

error[E0277]: `std::vec::Vec<bool>` is not an iterator
   --> src/test.rs:10:1
    |
164 | #[mutate]
    | ^^^^^^^^^ `std::vec::Vec<bool>` is not an iterator
    |
    = help: the trait `std::iter::Iterator` is not implemented for `std::vec::Vec<bool>`
    = note: required by `mutagen::forloop`

error: aborting due to previous error

It works only if i explicitly put xs.iter().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions