]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/issue-55541.rs
Rollup merge of #62388 - rust-lang:fix-loop-break-mir-generation, r=eddyb
[rust.git] / src / test / ui / consts / const-eval / issue-55541.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 // Test that we can handle newtypes wrapping extern types
4
5 #![feature(extern_types, const_transmute)]
6
7 use std::marker::PhantomData;
8
9 extern "C" {
10   pub type ExternType;
11 }
12 unsafe impl Sync for ExternType {}
13 static MAGIC_FFI_STATIC: u8 = 42;
14
15 #[repr(transparent)]
16 pub struct Wrapper(ExternType);
17 pub static MAGIC_FFI_REF: &'static Wrapper = unsafe {
18   std::mem::transmute(&MAGIC_FFI_STATIC)
19 };
20
21 #[repr(transparent)]
22 pub struct Wrapper2(PhantomData<Vec<i32>>, ExternType);
23 pub static MAGIC_FFI_REF2: &'static Wrapper2 = unsafe {
24   std::mem::transmute(&MAGIC_FFI_STATIC)
25 };
26
27 fn main() {}