]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/uninhabited-enum.rs
Auto merge of #69265 - ehuss:update-cargo, r=Dylan-DPC
[rust.git] / src / test / mir-opt / uninhabited-enum.rs
1 #![feature(never_type)]
2
3 pub enum Void {}
4
5 #[no_mangle]
6 pub fn process_never(input: *const !) {
7    let _input = unsafe { &*input };
8 }
9
10 #[no_mangle]
11 pub fn process_void(input: *const Void) {
12    let _input = unsafe { &*input };
13    // In the future, this should end with `unreachable`, but we currently only do
14    // unreachability analysis for `!`.
15 }
16
17 fn main() {}
18
19 // END RUST SOURCE
20 //
21 // START rustc.process_never.SimplifyLocals.after.mir
22 // bb0: {
23 //     StorageLive(_2);
24 //     _2 = &(*_1);
25 //     StorageDead(_2);
26 //     unreachable;
27 // }
28 // END rustc.process_never.SimplifyLocals.after.mir
29 //
30 // START rustc.process_void.SimplifyLocals.after.mir
31 // bb0: {
32 //     StorageLive(_2);
33 //     _2 = &(*_1);
34 //     StorageDead(_2);
35 //     return;
36 // }
37 // END rustc.process_void.SimplifyLocals.after.mir