mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
9 lines
246 B
Rust
9 lines
246 B
Rust
// Check that you can't dereference invalid raw pointers in constants.
|
|
|
|
fn main() {
|
|
static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
|
|
//~^ ERROR could not evaluate static initializer
|
|
//~| dangling pointer
|
|
println!("{}", C);
|
|
}
|