]> git.proxmox.com Git - rustc.git/blob - tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / rfc-2008-non-exhaustive / improper_ctypes / extern_crate_improper.rs
1 // aux-build:types.rs
2 #![deny(improper_ctypes)]
3
4 extern crate types;
5
6 // This test checks that non-exhaustive types with `#[repr(C)]` from an extern crate are considered
7 // improper.
8
9 use types::{NonExhaustiveEnum, NonExhaustiveVariants, NormalStruct, TupleStruct, UnitStruct};
10
11 extern "C" {
12 pub fn non_exhaustive_enum(_: NonExhaustiveEnum);
13 //~^ ERROR `extern` block uses type `NonExhaustiveEnum`, which is not FFI-safe
14 pub fn non_exhaustive_normal_struct(_: NormalStruct);
15 //~^ ERROR `extern` block uses type `NormalStruct`, which is not FFI-safe
16 pub fn non_exhaustive_unit_struct(_: UnitStruct);
17 //~^ ERROR `extern` block uses type `UnitStruct`, which is not FFI-safe
18 pub fn non_exhaustive_tuple_struct(_: TupleStruct);
19 //~^ ERROR `extern` block uses type `TupleStruct`, which is not FFI-safe
20 pub fn non_exhaustive_variant(_: NonExhaustiveVariants);
21 //~^ ERROR `extern` block uses type `NonExhaustiveVariants`, which is not FFI-safe
22 }
23
24 fn main() {}