2021-01-20 19:50:21 -06:00
|
|
|
#![warn(unused_labels)]
|
|
|
|
|
2020-12-14 06:14:17 -06:00
|
|
|
fn main() {
|
|
|
|
'while_loop: while true { //~ WARN denote infinite loops with
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2020-12-14 06:14:17 -06:00
|
|
|
while_loop;
|
|
|
|
//~^ ERROR cannot find value `while_loop` in this scope
|
|
|
|
};
|
|
|
|
'while_let: while let Some(_) = Some(()) {
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2020-12-14 06:14:17 -06:00
|
|
|
while_let;
|
|
|
|
//~^ ERROR cannot find value `while_let` in this scope
|
|
|
|
}
|
|
|
|
'for_loop: for _ in 0..3 {
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2020-12-14 06:14:17 -06:00
|
|
|
for_loop;
|
|
|
|
//~^ ERROR cannot find value `for_loop` in this scope
|
|
|
|
};
|
2021-01-20 19:25:27 -06:00
|
|
|
'LOOP: loop {
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2021-01-20 19:25:27 -06:00
|
|
|
LOOP;
|
|
|
|
//~^ ERROR cannot find value `LOOP` in this scope
|
|
|
|
};
|
2020-12-14 06:14:17 -06:00
|
|
|
}
|
2021-01-19 17:51:51 -06:00
|
|
|
|
|
|
|
fn foo() {
|
|
|
|
'LOOP: loop {
|
|
|
|
break LOOP;
|
|
|
|
//~^ ERROR cannot find value `LOOP` in this scope
|
|
|
|
};
|
|
|
|
'while_loop: while true { //~ WARN denote infinite loops with
|
|
|
|
break while_loop;
|
|
|
|
//~^ ERROR cannot find value `while_loop` in this scope
|
|
|
|
};
|
|
|
|
'while_let: while let Some(_) = Some(()) {
|
|
|
|
break while_let;
|
|
|
|
//~^ ERROR cannot find value `while_let` in this scope
|
|
|
|
}
|
|
|
|
'for_loop: for _ in 0..3 {
|
|
|
|
break for_loop;
|
|
|
|
//~^ ERROR cannot find value `for_loop` in this scope
|
2021-01-20 19:25:27 -06:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
let foo = ();
|
|
|
|
'while_loop: while true { //~ WARN denote infinite loops with
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2021-01-20 19:25:27 -06:00
|
|
|
break foo;
|
|
|
|
//~^ ERROR `break` with value from a `while` loop
|
|
|
|
};
|
|
|
|
'while_let: while let Some(_) = Some(()) {
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2021-01-20 19:25:27 -06:00
|
|
|
break foo;
|
|
|
|
//~^ ERROR `break` with value from a `while` loop
|
|
|
|
}
|
|
|
|
'for_loop: for _ in 0..3 {
|
2021-01-20 19:50:21 -06:00
|
|
|
//~^ WARN unused label
|
2021-01-20 19:25:27 -06:00
|
|
|
break foo;
|
|
|
|
//~^ ERROR `break` with value from a `for` loop
|
2021-01-19 17:51:51 -06:00
|
|
|
};
|
|
|
|
}
|