2017-03-21 13:41:41 +00:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(unused_assignments)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![deny(unreachable_code)]
|
|
|
|
|
|
|
|
fn foo() {
|
|
|
|
while {return} {
|
2021-08-08 14:49:13 +00:00
|
|
|
//~^ ERROR unreachable block in `if`
|
2017-03-21 13:41:41 +00:00
|
|
|
println!("Hello, world!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
while {true} {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
println!("I am not dead.");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn baz() {
|
|
|
|
// Here, we cite the `while` loop as dead.
|
|
|
|
while {return} {
|
2021-08-08 14:49:13 +00:00
|
|
|
//~^ ERROR unreachable block in `if`
|
2017-03-21 13:41:41 +00:00
|
|
|
println!("I am dead.");
|
|
|
|
}
|
|
|
|
println!("I am, too.");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|