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-26 00:12:51 +00:00
2014-07-26 00:12:51 +00:00
pub fn main() {
2015-01-25 21:05:03 +00:00
let mut i = 100;
'w: while 1 + 1 == 2 {
2014-07-26 00:12:51 +00:00
i -= 1;
if i == 95 {
break 'w;
panic!("Should have broken out of loop");
2014-07-26 00:12:51 +00:00
}
}
assert_eq!(i, 95);
}