And I think (i32::MIN..=10).rev() also works in most cases. But it is still fascinating to me to realize (..=10).rev(), because it is so clear what it means.
I beg to differ. The documentation explicitly states that the problem is it's got no beginning. So how would .rev() decide when to stop? If you want (0..=10).rev() or i32::MIN..=10).rev() then you should write that. It is clear enough.
It doesnāt stop, thatās the whole point. Just like 42.. doesnāt stop.
The iterator is infinite; naturally it can eventually overflow because the integer range is finite, resulting in wrap-around on release mode, or panic in debug mode. But it saves the bounds check, which is why itās useful, I guess.
No, I don't think that's correct. 42.. already doesn't stop by itself, but ..42 doesn't begin anywhere. However, it would have to have a definite first element in order to be an iterator in the first place, so the stdlib is perfectly correct in observing this ā perhaps counter-intuitive, but technically necessary ā asymmetry.
This seems like a fixable problem. I'm currently (slowly) starting to work on some RFC at the moment that should make such changes possible in a non-breaking manner; good to have another (potential) example use-case here.
So I proposed two ways: (1) adding RangeTo::rev() method apart from Iterator::rev(), or (2) splitting DoubleEndedIterator into Iterator and ReverseIterator.
In fact I don't have a concrete idea for (2) without breaking changes, though.