about summary refs log tree commit diff
path: root/tests/ui/loop-match/break-to-block.rs
blob: e7451a944c3910ed7b2e0eb4f72b72b9159ff330 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Test that a `break` without `#[const_continue]` still works as expected.

//@ run-pass

#![allow(incomplete_features)]
#![feature(loop_match)]

fn main() {
    assert_eq!(helper(), 1);
}

fn helper() -> u8 {
    let mut state = 0u8;
    #[loop_match]
    'a: loop {
        state = 'blk: {
            match state {
                0 => break 'blk 1,
                _ => break 'a state,
            }
        }
    }
}