]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/issue-55541.rs
miri: accept extern types in structs if they are the only field
[rust.git] / src / test / ui / consts / const-eval / issue-55541.rs
1 // compile-pass
2
3 // Test that we can handle newtypes wrapping extern types
4
5 #![feature(extern_types, const_transmute)]
6
7 extern "C" {
8   pub type ExternType;
9 }
10 unsafe impl Sync for ExternType {}
11
12 #[repr(transparent)]
13 pub struct Wrapper(ExternType);
14
15 static MAGIC_FFI_STATIC: u8 = 42;
16
17 pub static MAGIC_FFI_REF: &'static Wrapper = unsafe {
18   std::mem::transmute(&MAGIC_FFI_STATIC)
19 };
20
21 fn main() {}