aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/test_data/parser/ok/0033_label_break.rs
blob: 728d78137c99ecba6cd3773883d717879dc8e848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// format with label break value.
fn main() {
    'empty_block: {}

    'block: {
        do_thing();
        if condition_not_met() {
            break 'block;
        }
        do_next_thing();
        if condition_not_met() {
            break 'block;
        }
        do_last_thing();
    }

    let result = 'block: {
        if foo() {
            // comment
            break 'block 1;
        }
        if bar() {
            /* comment */
            break 'block 2;
        }
        3
    };
}