blob: 9b3c80b97542e32981115f74541b9180f3ceb35f [file] [edit]
// Test that a null `MaybeDangling<&u8>` is still detected as UB.
//
//@compile-flags: -Zmiri-disable-stacked-borrows
#![feature(maybe_dangling)]
use std::mem::{MaybeDangling, transmute};
use std::ptr::null;
fn main() {
let null = MaybeDangling::new(null());
unsafe { transmute::<MaybeDangling<*const u8>, MaybeDangling<&u8>>(null) };
//~^ ERROR: encountered a null reference
}