]>
Commit | Line | Data |
---|---|---|
cc61c64b XL |
1 | #![allow(unused_variables)] |
2 | #![allow(unused_assignments)] | |
32a655c1 | 3 | #![allow(dead_code)] |
cc61c64b | 4 | #![deny(unreachable_code)] |
cc61c64b XL |
5 | |
6 | fn foo() { | |
94222f64 | 7 | if {return} { //~ ERROR unreachable block in `if` |
cc61c64b XL |
8 | println!("Hello, world!"); |
9 | } | |
10 | } | |
11 | ||
12 | fn bar() { | |
13 | if {true} { | |
14 | return; | |
15 | } | |
16 | println!("I am not dead."); | |
17 | } | |
18 | ||
19 | fn baz() { | |
20 | if {true} { | |
21 | return; | |
22 | } else { | |
23 | return; | |
24 | } | |
25 | // As the next action to be taken after the if arms, we should | |
26 | // report the `println!` as unreachable: | |
27 | println!("But I am."); | |
8faf50e0 | 28 | //~^ ERROR unreachable statement |
cc61c64b | 29 | } |
a7813a04 | 30 | |
32a655c1 | 31 | fn main() { } |