summaryrefslogtreecommitdiffstats
path: root/tests/ui/never_type/never-result.rs
blob: 35af37910ef3e92f28039f0791df0f2eb689d2e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// run-pass

#![allow(unused_variables)]
#![allow(unreachable_code)]

// Test that we can extract a ! through pattern matching then use it as several different types.

#![feature(never_type)]

fn main() {
    let x: Result<u32, !> = Ok(123);
    match x {
        Ok(z) => (),
        Err(y) => {
            let q: u32 = y;
            let w: i32 = y;
            let e: String = y;
            y
        },
    }
}