rust/tests/ui/for-loop-while/while-label.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
260 B
Rust
Raw Normal View History

// run-pass
#![allow(unreachable_code)]
2014-07-25 19:12:51 -05:00
2014-07-25 19:12:51 -05:00
pub fn main() {
2015-01-25 15:05:03 -06:00
let mut i = 100;
'w: while 1 + 1 == 2 {
2014-07-25 19:12:51 -05:00
i -= 1;
if i == 95 {
break 'w;
panic!("Should have broken out of loop");
2014-07-25 19:12:51 -05:00
}
}
assert_eq!(i, 95);
}