|
| 1 | +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
| 2 | +// file at the top-level directory of this distribution and at |
| 3 | +// http://rust-lang.org/COPYRIGHT. |
| 4 | +// |
| 5 | +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | +// option. This file may not be copied, modified, or distributed |
| 9 | +// except according to those terms. |
| 10 | + |
| 11 | +#![feature(never_type)] |
| 12 | +#![allow(dead_code)] |
| 13 | +#![allow(path_statements)] |
| 14 | +#![allow(unreachable_patterns)] |
| 15 | + |
| 16 | +fn never_direct(x: !) { |
| 17 | + x; |
| 18 | +} |
| 19 | + |
| 20 | +fn never_ref_pat(ref x: !) { |
| 21 | + *x; |
| 22 | +} |
| 23 | + |
| 24 | +fn never_ref(x: &!) { |
| 25 | + let &y = x; |
| 26 | + y; |
| 27 | +} |
| 28 | + |
| 29 | +fn never_slice(x: &[!]) { |
| 30 | + x[0]; |
| 31 | +} |
| 32 | + |
| 33 | +fn never_match(x: Result<(), !>) { |
| 34 | + match x { |
| 35 | + Ok(_) => {}, |
| 36 | + Err(_) => {}, |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +pub fn main() { } |
| 41 | + |
| 42 | +// END RUST SOURCE |
| 43 | + |
| 44 | +// START rustc.never_direct.SimplifyCfg-initial.after.mir |
| 45 | +// bb0: { |
| 46 | +// unreachable; |
| 47 | +// } |
| 48 | +// END rustc.never_direct.SimplifyCfg-initial.after.mir |
| 49 | + |
| 50 | +// START rustc.never_ref_pat.SimplifyCfg-initial.after.mir |
| 51 | +// bb0: { |
| 52 | +// unreachable; |
| 53 | +// } |
| 54 | +// END rustc.never_ref_pat.SimplifyCfg-initial.after.mir |
| 55 | + |
| 56 | +// START rustc.never_ref.SimplifyCfg-initial.after.mir |
| 57 | +// bb0: { |
| 58 | +// unreachable; |
| 59 | +// } |
| 60 | +// END rustc.never_ref.SimplifyCfg-initial.after.mir |
| 61 | + |
| 62 | +// START rustc.never_slice.SimplifyCfg-initial.after.mir |
| 63 | +// bb1: { |
| 64 | +// ... |
| 65 | +// unreachable; |
| 66 | +// } |
| 67 | +// END rustc.never_slice.SimplifyCfg-initial.after.mir |
| 68 | + |
| 69 | +// START rustc.never_match.SimplifyCfg-initial.after.mir |
| 70 | +// fn never_match(_1: std::result::Result<(), !>) -> () { |
| 71 | +// ... |
| 72 | +// bb0: { |
| 73 | +// ... |
| 74 | +// } |
| 75 | +// bb1: { |
| 76 | +// unreachable; |
| 77 | +// } |
| 78 | +// bb2: { |
| 79 | +// _0 = (); |
| 80 | +// return; |
| 81 | +// } |
| 82 | +// } |
| 83 | +// END rustc.never_match.SimplifyCfg-initial.after.mir |
0 commit comments