test for validity of references pointing to uninhabited types
This commit is contained in:
parent
a5cf247469
commit
30548bb57e
6
tests/compile-fail/validity/ref_to_uninhabited1.rs
Normal file
6
tests/compile-fail/validity/ref_to_uninhabited1.rs
Normal file
@ -0,0 +1,6 @@
|
||||
#![feature(never_type)]
|
||||
use std::mem::transmute;
|
||||
|
||||
fn main() { unsafe {
|
||||
let _x: &! = transmute(&42); //~ERROR encountered a reference pointing to uninhabited type !
|
||||
} }
|
7
tests/compile-fail/validity/ref_to_uninhabited2.rs
Normal file
7
tests/compile-fail/validity/ref_to_uninhabited2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
use std::mem::transmute;
|
||||
|
||||
enum Void {}
|
||||
|
||||
fn main() { unsafe {
|
||||
let _x: &(i32, Void) = transmute(&42); //~ERROR encountered a reference pointing to uninhabited type (i32, Void)
|
||||
} }
|
Loading…
x
Reference in New Issue
Block a user