mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

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

Open bblum opened this issue 5 years ago • 0 comments

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 avatar Apr 15 '19 19:04 bblum