about summary refs log tree commit diff
path: root/tests/ui/consts/const-cast.rs
blob: 9a4cce97e3ee8e0bdab80f232c890bbcacf3ca29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ run-pass
#![allow(non_upper_case_globals)]

struct TestStruct {
    x: *const u8,
}

unsafe impl Sync for TestStruct {}

extern "C" fn foo() {}
const x: extern "C" fn() = foo;
static y: TestStruct = TestStruct { x: x as *const u8 };

pub fn main() {
    assert_eq!(x as *const u8, y.x);
}