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