mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-07 08:26:14 +00:00
8 lines
201 B
Rust
8 lines
201 B
Rust
// 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);
|
|
}
|