Closed
Description
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:
1
1
1
1
1
Expected Output:
1
2
3
4
5
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.
Metadata
Metadata
Assignees
Labels
No labels