2017-03-21 08:41:41 -05:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(unused_assignments)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![deny(unreachable_code)]
|
|
|
|
|
|
|
|
fn foo() {
|
2019-03-18 22:47:07 -05:00
|
|
|
if {return} { //~ ERROR unreachable block in `if` expression
|
2017-03-21 08:41:41 -05:00
|
|
|
println!("Hello, world!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
if {true} {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
println!("I am not dead.");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn baz() {
|
|
|
|
if {true} {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// As the next action to be taken after the if arms, we should
|
|
|
|
// report the `println!` as unreachable:
|
|
|
|
println!("But I am.");
|
2018-07-19 07:15:43 -05:00
|
|
|
//~^ ERROR unreachable statement
|
2017-03-21 08:41:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|