1 // Issue #21633: reject duplicate loop labels in function bodies.
2 // This is testing interaction between lifetime-params and labels.
6 #![allow(dead_code, unused_variables)]
10 'a
: loop { break 'a; }
11 //~^ WARN label name `'a` shadows a lifetime name that is already in scope
14 struct Struct
<'b
, 'c
> { _f: &'b i8, _g: &'c i8 }
15 enum Enum
<'d
, 'e
> { A(&'d i8), B(&'e i8) }
17 impl<'d
, 'e
> Struct
<'d
, 'e
> {
19 'a
: loop { break 'a; }
20 'b
: loop { break 'b; }
21 'c
: loop { break 'c; }
25 impl <'d
, 'e
> Enum
<'d
, 'e
> {
27 'a
: loop { break 'a; }
28 'b
: loop { break 'b; }
29 'c
: loop { break 'c; }
33 impl<'bad
, 'c
> Struct
<'bad
, 'c
> {
35 'bad
: loop { break 'bad; }
36 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
40 impl<'b
, 'bad
> Struct
<'b
, 'bad
> {
42 'bad
: loop { break 'bad; }
43 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
47 impl<'b
, 'c
> Struct
<'b
, 'c
> {
48 fn meth_bad3
<'bad
>(x
: &'bad
i8) {
49 'bad
: loop { break 'bad; }
50 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
53 fn meth_bad4
<'a
,'bad
>(x
: &'a
i8, y
: &'bad
i8) {
54 'bad
: loop { break 'bad; }
55 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
59 impl <'bad
, 'e
> Enum
<'bad
, 'e
> {
61 'bad
: loop { break 'bad; }
62 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
65 impl <'d
, 'bad
> Enum
<'d
, 'bad
> {
67 'bad
: loop { break 'bad; }
68 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
71 impl <'d
, 'e
> Enum
<'d
, 'e
> {
72 fn meth_bad3
<'bad
>(x
: &'bad
i8) {
73 'bad
: loop { break 'bad; }
74 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
77 fn meth_bad4
<'a
,'bad
>(x
: &'bad
i8) {
78 'bad
: loop { break 'bad; }
79 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
83 trait HasDefaultMethod1
<'bad
> {
85 'c
: loop { break 'c; }
88 'bad
: loop { break 'bad; }
89 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
92 trait HasDefaultMethod2
<'a
,'bad
> {
94 'bad
: loop { break 'bad; }
95 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope
98 trait HasDefaultMethod3
<'a
,'b
> {
99 fn meth_bad
<'bad
>(&self) {
100 'bad
: loop { break 'bad; }
101 //~^ WARN label name `'bad` shadows a lifetime name that is already in scope