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