Is there anyway to create an iterator that would fail to compile when calling next on it while a previous result is still in scope?
So in code like the following:
let a = iter.next().unwrap(); let b = iter.next().unwrap(); *a = 0; *b = 0;
The second call to next would fail.
I think there isn't cause the returned references have the lifetime of the iterator not of the next call but perhaps there's any way to do it?