Fix never-type rvalue ICE
This commit is contained in:
parent
da569fa9dd
commit
6461532afa
3 changed files with 54 additions and 2 deletions
46
src/test/run-pass/never-type-rvalues.rs
Normal file
46
src/test/run-pass/never-type-rvalues.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(never_type)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(path_statements)]
|
||||
#![allow(unreachable_patterns)]
|
||||
|
||||
fn never_direct(x: !) {
|
||||
x;
|
||||
}
|
||||
|
||||
fn never_ref_pat(ref x: !) {
|
||||
*x;
|
||||
}
|
||||
|
||||
fn never_ref(x: &!) {
|
||||
let &y = x;
|
||||
y;
|
||||
}
|
||||
|
||||
fn never_pointer(x: *const !) {
|
||||
unsafe {
|
||||
*x;
|
||||
}
|
||||
}
|
||||
|
||||
fn never_slice(x: &[!]) {
|
||||
x[0];
|
||||
}
|
||||
|
||||
fn never_match(x: Result<(), !>) {
|
||||
match x {
|
||||
Ok(_) => {},
|
||||
Err(_) => {},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue