Experimenting with using the iterator inside the loop (awsome feature), found weird bug
fn main() {
let mut it = range(0u, 5);
for i in it {
println!("{}", i)
if i == -23 {
it.next();
}
}
}
Using rustc 0.12.0-pre (66a0b52 2014-07-25 20:36:10 +0000)
Actual Output:
Expected Output:
Bug needs optimization level 2 or higher -- so it is probably undefined behavior-related.
The actual condition doesn't matter, I just picked one that would never be true.