]> git.lizzy.rs Git - rust.git/blob - tests/ui/for-loop-while/foreach-external-iterators-break.rs
Rollup merge of #106144 - tgross35:patch-1, r=Mark-Simulacrum
[rust.git] / tests / ui / for-loop-while / foreach-external-iterators-break.rs
1 // run-pass
2
3 pub fn main() {
4     let x = [1; 100];
5     let mut y = 0;
6     for i in &x[..] {
7         if y > 10 {
8             break;
9         }
10         y += *i;
11     }
12     assert_eq!(y, 11);
13 }