rust/tests/fail/validity/ref_to_uninhabited1.rs
2022-07-11 11:48:56 +00:00

10 lines
215 B
Rust

#![feature(never_type)]
use std::mem::{forget, transmute};
fn main() {
unsafe {
let x: Box<!> = transmute(&mut 42); //~ERROR: encountered a box pointing to uninhabited type !
forget(x);
}
}