rust/tests/ui/consts/const-cast-ptr-int.rs

17 lines
246 B
Rust
Raw Permalink Normal View History

//@ run-pass
#![allow(non_upper_case_globals)]
use std::ptr;
2014-12-06 16:39:25 +00:00
struct TestStruct {
x: *const u8
}
2014-12-21 23:49:42 +00:00
unsafe impl Sync for TestStruct {}
2014-12-06 16:39:25 +00:00
static a: TestStruct = TestStruct{x: 0 as *const u8};
2013-03-27 16:58:28 +00:00
pub fn main() {
2014-12-06 16:39:25 +00:00
assert_eq!(a.x, ptr::null());
2013-03-07 03:09:17 +00:00
}