rust/src/test/ui/consts/issue-83182.rs

7 lines
237 B
Rust
Raw Normal View History

2021-05-15 08:04:41 -05:00
use std::mem;
struct MyStr(str);
const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
//~^ ERROR: it is undefined behavior to use this value
//~| type validation failed: encountered a pointer in `str`
fn main() {}