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