Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e1ec3260d79497080ca86540562d410ba67d2a95
77972d2d0134fb597249b3b64dcf9510a790c34e
7 changes: 7 additions & 0 deletions tests/compile-fail/validity/ref_to_uninhabited1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![feature(never_type)]
use std::mem::{transmute, forget};

fn main() { unsafe {
let x: Box<!> = transmute(&mut 42); //~ERROR encountered a box pointing to uninhabited type !
forget(x);
} }
7 changes: 7 additions & 0 deletions tests/compile-fail/validity/ref_to_uninhabited2.rs
Original file line number Diff line number Diff line change
@@ -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)
} }