Closed
Description
pub static mut X: usize = unsafe { &X as *const _ as usize };
The value of static and const variables must be known at compile time. You
can't cast a pointer as an integer because we can't know what value the
address will take.
This is incorrect as the following code shows:
pub static mut X: *const u8 = unsafe { &X as *const _ as *const _ };
The value of X
is only known at link time.
Metadata
Metadata
Assignees
Labels
No labels