macro_rules! loop_x {
($e: expr) => {
// $e shouldn't be able to interact with this 'x
- 'x: loop { $e }
- //~^ WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- }
+ 'x: loop {
+ $e
+ }
+ };
}
macro_rules! while_true {
($e: expr) => {
// $e shouldn't be able to interact with this 'x
- 'x: while 1 + 1 == 2 { $e }
- //~^ WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- }
+ 'x: while 1 + 1 == 2 {
+ $e
+ }
+ };
}
macro_rules! run_once {
($e: expr) => {
// ditto
- 'x: for _ in 0..1 { $e }
- //~^ WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- }
+ 'x: for _ in 0..1 {
+ $e
+ }
+ };
}
pub fn main() {
let k: isize = {
'x: for _ in 0..1 {
//~^ WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
// ditto
loop_x!(break 'x);
i += 1;
let l: isize = {
'x: for _ in 0..1 {
//~^ WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
// ditto
while_true!(break 'x);
i += 1;
let n: isize = {
'x: for _ in 0..1 {
//~^ WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
- //~| WARNING shadows a label name that is already in scope
// ditto
run_once!(continue 'x);
i += 1;