]> git.lizzy.rs Git - rust.git/blob - src/test/ui/never-result.rs
Auto merge of #65422 - tmandry:rollup-r5u3mlc, r=tmandry
[rust.git] / src / test / ui / never-result.rs
1 // run-pass
2
3 #![allow(unused_variables)]
4 #![allow(unreachable_code)]
5 // Test that we can extract a ! through pattern matching then use it as several different types.
6
7 #![feature(never_type)]
8
9 fn main() {
10     let x: Result<u32, !> = Ok(123);
11     match x {
12         Ok(z) => (),
13         Err(y) => {
14             let q: u32 = y;
15             let w: i32 = y;
16             let e: String = y;
17             y
18         },
19     }
20 }