]> git.lizzy.rs Git - rust.git/blob - src/test/ui/reachable/expr_block.rs
Rollup merge of #92959 - asquared31415:test-non-fn-help, r=estebank
[rust.git] / src / test / ui / reachable / expr_block.rs
1 #![allow(unused_variables)]
2 #![allow(unused_assignments)]
3 #![allow(dead_code)]
4 #![deny(unreachable_code)]
5
6 fn a() {
7     // Here the tail expression is considered unreachable:
8     let x = {
9         return;
10         22 //~ ERROR unreachable
11     };
12 }
13
14 fn b() {
15     // Here the `x` assignment is considered unreachable, not the block:
16     let x = {
17         return;
18     };
19 }
20
21 fn c() {
22     // Here the `println!` is unreachable:
23     let x = {
24         return;
25         println!("foo");
26         //~^ ERROR unreachable statement
27         22
28     };
29 }
30
31 fn main() { }