Skip to content

Commit c1385be

Browse files
committed
test for validity of references pointing to uninhabited types
1 parent 19ef764 commit c1385be

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(never_type)]
2+
use std::mem::transmute;
3+
4+
fn main() { unsafe {
5+
let _x: &! = transmute(&42); //~ERROR encountered a reference pointing to uninhabited type !
6+
} }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::mem::transmute;
2+
3+
enum Void {}
4+
5+
fn main() { unsafe {
6+
let _x: &(i32, Void) = transmute(&42); //~ERROR encountered a reference pointing to uninhabited type (i32, Void)
7+
} }

0 commit comments

Comments
 (0)