On Thu, Feb 13, 2014 at 6:33 PM, Erick Tryzelaar <erick.tryzel...@gmail.com> wrote: > On Thursday, February 13, 2014, Gábor Lehel <glaebho...@gmail.com> wrote: >> >> >> >> This is not strictly true. >> >> If instead of >> >> fn next(&mut self) -> Option<A>; >> >> we had something like >> >> fn next(self) -> Option<(Self, A)>; >> >> then access to exhausted iterators would be ruled out at the type level. >> >> (But it's more cumbersome to work with and is currently incompatible with >> trait objects.) > > This is an appealing option. If it is really this simple to close this > undefined behavior, I think we should consider it. Are there any other > downsides? Does it optimize down to the same code as our current iterators?
It's certainly not as convenient and would only work if all iterators were marked as `NoPod`. _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev