2 #![allow(unreachable_code)]
3 #![allow(unused_labels)]
5 // Test that labels injected by macros do not break hygiene. This
6 // checks cases where the macros invocations are under the rhs of a
9 // Issue #24278: The label/lifetime shadowing checker from #24162
10 // conservatively ignores hygiene, and thus issues warnings that are
11 // both true- and false-positives for this test.
15 // $e shouldn't be able to interact with this 'x
17 //~^ WARNING shadows a label name that is already in scope
18 //~| WARNING shadows a label name that is already in scope
19 //~| WARNING shadows a label name that is already in scope
20 //~| WARNING shadows a label name that is already in scope
24 macro_rules! while_true {
26 // $e shouldn't be able to interact with this 'x
27 'x: while 1 + 1 == 2 { $e }
28 //~^ WARNING shadows a label name that is already in scope
29 //~| WARNING shadows a label name that is already in scope
30 //~| WARNING shadows a label name that is already in scope
31 //~| WARNING shadows a label name that is already in scope
32 //~| WARNING shadows a label name that is already in scope
36 macro_rules! run_once {
39 'x: for _ in 0..1 { $e }
40 //~^ WARNING shadows a label name that is already in scope
41 //~| WARNING shadows a label name that is already in scope
42 //~| WARNING shadows a label name that is already in scope
43 //~| WARNING shadows a label name that is already in scope
44 //~| WARNING shadows a label name that is already in scope
45 //~| WARNING shadows a label name that is already in scope
46 //~| WARNING shadows a label name that is already in scope
55 // this 'x should refer to the outer loop, lexically
65 //~^ WARNING shadows a label name that is already in scope
66 //~| WARNING shadows a label name that is already in scope
77 //~^ WARNING shadows a label name that is already in scope
78 //~| WARNING shadows a label name that is already in scope
79 //~| WARNING shadows a label name that is already in scope
80 //~| WARNING shadows a label name that is already in scope
82 while_true!(break 'x);
91 //~^ WARNING shadows a label name that is already in scope
92 //~| WARNING shadows a label name that is already in scope
93 //~| WARNING shadows a label name that is already in scope
94 //~| WARNING shadows a label name that is already in scope
95 //~| WARNING shadows a label name that is already in scope
96 //~| WARNING shadows a label name that is already in scope
98 run_once!(continue 'x);