Should Map<I: DoubleEndedIterator, F> really implement DoubleEndedIterator?

50 points This_Hippo

Having mapped iterators be rev()able can lead to confusing situations with impure mapping functions:

fn main() {
    let mut add = 10;
    [1, 2, 3]
        .iter()
        .rev()
        .map(|x| {
            let new = x + add;
            add = 0;
            new
        })
        .rev()
        .for_each(|x| println!("{x}"));
}

prints 11 2 3, not 1 2 13. I just spent a good hour debugging this, which makes me think maybe Map shouldn’t implement DoubleEndedIterator. Thoughts?