summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/lint-ffi-safety-all-phantom.rs
blob: 7419d34580097c3d05d4b4df1c4dd3f77af69bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// This is a regression test for issue https://github.com/rust-lang/rust/issues/106629.
// It ensures that transparent types where all fields are PhantomData are marked as
// FFI-safe.

// check-pass

#[repr(transparent)]
#[derive(Copy, Clone)]
struct MyPhantom(core::marker::PhantomData<u8>);

#[repr(C)]
#[derive(Copy, Clone)]
pub struct Bar {
    pub x: i32,
    _marker: MyPhantom,
}

extern "C" {
    pub fn foo(bar: *mut Bar);
}

fn main() {}