diff options
Diffstat (limited to 'tests/ui/for-loop-while/issue-2216.rs')
-rw-r--r-- | tests/ui/for-loop-while/issue-2216.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/for-loop-while/issue-2216.rs b/tests/ui/for-loop-while/issue-2216.rs new file mode 100644 index 000000000..ad5410742 --- /dev/null +++ b/tests/ui/for-loop-while/issue-2216.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(unreachable_code)] +pub fn main() { + let mut x = 0; + + 'foo: loop { + 'bar: loop { + loop { + if 1 == 2 { + break 'foo; + } + else { + break 'bar; + } + } + continue 'foo; + } + x = 42; + break; + } + + println!("{}", x); + assert_eq!(x, 42); +} |