]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/lint-ffi-safety-all-phantom.rs
Rollup merge of #106785 - compiler-errors:better-impl-wf-spans, r=estebank
[rust.git] / tests / ui / lint / lint-ffi-safety-all-phantom.rs
1 // This is a regression test for issue https://github.com/rust-lang/rust/issues/106629.
2 // It ensures that transparent types where all fields are PhantomData are marked as
3 // FFI-safe.
4
5 // check-pass
6
7 #[repr(transparent)]
8 #[derive(Copy, Clone)]
9 struct MyPhantom(core::marker::PhantomData<u8>);
10
11 #[repr(C)]
12 #[derive(Copy, Clone)]
13 pub struct Bar {
14     pub x: i32,
15     _marker: MyPhantom,
16 }
17
18 extern "C" {
19     pub fn foo(bar: *mut Bar);
20 }
21
22 fn main() {}