• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
2 #[repr(C)]
3 #[derive(Debug, Copy, Clone)]
4 pub struct Foo {
5     _unused: [u8; 0],
6 }
7 #[repr(C)]
8 #[derive(Debug, Copy, Clone)]
9 pub struct RefPtr<T> {
10     pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11     pub m_inner: *mut T,
12 }
13 impl<T> Default for RefPtr<T> {
default() -> Self14     fn default() -> Self {
15         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16         unsafe {
17             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
18             s.assume_init()
19         }
20     }
21 }
22 #[repr(C)]
23 #[derive(Debug, Copy, Clone)]
24 pub struct Bar {
25     pub m_member: RefPtr<Foo>,
26 }
27 #[allow(clippy::unnecessary_operation, clippy::identity_op)]
28 const _: () = {
29     ["Size of Bar"][::std::mem::size_of::<Bar>() - 8usize];
30     ["Alignment of Bar"][::std::mem::align_of::<Bar>() - 8usize];
31     ["Offset of field: Bar::m_member"][::std::mem::offset_of!(Bar, m_member) - 0usize];
32 };
33 impl Default for Bar {
default() -> Self34     fn default() -> Self {
35         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
36         unsafe {
37             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
38             s.assume_init()
39         }
40     }
41 }
42 #[allow(clippy::unnecessary_operation, clippy::identity_op)]
43 const _: () = {
44     [
45         "Size of template specialization: RefPtr_open0_Foo_close0",
46     ][::std::mem::size_of::<RefPtr<Foo>>() - 8usize];
47     [
48         "Align of template specialization: RefPtr_open0_Foo_close0",
49     ][::std::mem::align_of::<RefPtr<Foo>>() - 8usize];
50 };
51