about summary refs log tree commit diff
path: root/tests/ui/consts/const-deref-ptr.rs
blob: ae928f55ebd8676458f3c94a2aafb4fe76c904dc (plain)
1
2
3
4
5
6
7
// Check that you can't dereference invalid raw pointers in constants.

fn main() {
    static C: u64 = unsafe { *(0xdeadbeef as *const u64) };
    //~^ ERROR dangling pointer
    println!("{}", C);
}