]> git.lizzy.rs Git - rust.git/blob - src/test/ui/reachable/expr_while.rs
Merge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into sync-rustfmt-subtree
[rust.git] / src / test / ui / reachable / expr_while.rs
1 #![allow(unused_variables)]
2 #![allow(unused_assignments)]
3 #![allow(dead_code)]
4 #![deny(unreachable_code)]
5
6 fn foo() {
7     while {return} {
8         //~^ ERROR unreachable block in `if`
9         println!("Hello, world!");
10     }
11 }
12
13 fn bar() {
14     while {true} {
15         return;
16     }
17     println!("I am not dead.");
18 }
19
20 fn baz() {
21     // Here, we cite the `while` loop as dead.
22     while {return} {
23         //~^ ERROR unreachable block in `if`
24         println!("I am dead.");
25     }
26     println!("I am, too.");
27 }
28
29 fn main() { }