summaryrefslogtreecommitdiff
path: root/tests/expectations/tests/underscore.rs
blob: 8e5e4566828b9a8694b14ae50020190f086858ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#![allow(
    dead_code,
    non_snake_case,
    non_camel_case_types,
    non_upper_case_globals
)]

pub const __: ::std::os::raw::c_int = 10;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct ptr_t {
    pub __: [::std::os::raw::c_uchar; 8usize],
}
#[test]
fn bindgen_test_layout_ptr_t() {
    assert_eq!(
        ::std::mem::size_of::<ptr_t>(),
        8usize,
        concat!("Size of: ", stringify!(ptr_t))
    );
    assert_eq!(
        ::std::mem::align_of::<ptr_t>(),
        1usize,
        concat!("Alignment of ", stringify!(ptr_t))
    );
    assert_eq!(
        unsafe {
            let uninit = ::std::mem::MaybeUninit::<ptr_t>::uninit();
            let ptr = uninit.as_ptr();
            ::std::ptr::addr_of!((*ptr).__) as usize - ptr as usize
        },
        0usize,
        concat!("Offset of field: ", stringify!(ptr_t), "::", stringify!(__))
    );
}