4 // Issue #21633: reject duplicate loop labels in function bodies.
6 // This is testing the generalization (to the whole function body)
8 // https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833
10 #[allow(unused_labels)]
12 { 'fl: for _ in 0..10 { break; } }
13 { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope
14 { 'lf: loop { break; } }
15 { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope
16 { 'wl: while 2 > 1 { break; } }
17 { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope
18 { 'lw: loop { break; } }
19 { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope
20 { 'fw: for _ in 0..10 { break; } }
21 { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope
22 { 'wf: while 2 > 1 { break; } }
23 { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope
24 { 'tl: while let Some(_) = None::<i32> { break; } }
25 { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope
26 { 'lt: loop { break; } }
27 { 'lt: while let Some(_) = None::<i32> { break; } }
28 //~^ WARN label name `'lt` shadows a label name that is already in scope