summaryrefslogtreecommitdiffstats
path: root/src/test/ui/reachable/unwarned-match-on-never.rs
blob: 71f8fe3a783e2247ba69b35d8fea2865f6e588ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#![deny(unreachable_code)]
#![allow(dead_code)]

#![feature(never_type)]

fn foo(x: !) -> bool {
    // Explicit matches on the never type are unwarned.
    match x {}
    // But matches in unreachable code are warned.
    match x {} //~ ERROR unreachable expression
}

fn bar() {
    match (return) {
        () => () //~ ERROR unreachable arm
    }
}

fn main() {
    return;
    match () { //~ ERROR unreachable expression
        () => (),
    }
}