2017-03-21 13:41:41 +00:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(unused_assignments)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![deny(unreachable_code)]
|
|
|
|
|
|
|
|
fn a() {
|
|
|
|
// Here the tail expression is considered unreachable:
|
|
|
|
let x = {
|
|
|
|
return;
|
2017-11-20 12:13:27 +00:00
|
|
|
22 //~ ERROR unreachable
|
2017-03-21 13:41:41 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn b() {
|
|
|
|
// Here the `x` assignment is considered unreachable, not the block:
|
|
|
|
let x = {
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn c() {
|
|
|
|
// Here the `println!` is unreachable:
|
|
|
|
let x = {
|
|
|
|
return;
|
|
|
|
println!("foo");
|
2018-07-19 12:15:43 +00:00
|
|
|
//~^ ERROR unreachable statement
|
2017-03-21 13:41:41 +00:00
|
|
|
22
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|