Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bblum opened this issue Apr 15, 2019 · 0 comments

Comments

@bblum
Copy link

bblum commented Apr 15, 2019

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().

@bblum bblum changed the title fails to recognize(?) iterable types in for loops iterator mutations fail to typecheck if the loop argument is not exactly an Iterator Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant