diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /tests/ui/rfc-2008-non-exhaustive/improper_ctypes | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/rfc-2008-non-exhaustive/improper_ctypes')
4 files changed, 0 insertions, 148 deletions
diff --git a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs b/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs deleted file mode 100644 index d6251fcb7..000000000 --- a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[non_exhaustive] -#[repr(C)] -pub enum NonExhaustiveEnum { - Unit, - Tuple(u32), - Struct { field: u32 } -} - -#[non_exhaustive] -#[repr(C)] -pub struct NormalStruct { - pub first_field: u16, - pub second_field: u16, -} - -#[non_exhaustive] -#[repr(C)] -pub struct UnitStruct; - -#[non_exhaustive] -#[repr(C)] -pub struct TupleStruct (pub u16, pub u16); - -#[repr(C)] -pub enum NonExhaustiveVariants { - #[non_exhaustive] Unit, - #[non_exhaustive] Tuple(u32), - #[non_exhaustive] Struct { field: u32 } -} diff --git a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs b/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs deleted file mode 100644 index 15c0c695f..000000000 --- a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs +++ /dev/null @@ -1,24 +0,0 @@ -// aux-build:types.rs -#![deny(improper_ctypes)] - -extern crate types; - -// This test checks that non-exhaustive types with `#[repr(C)]` from an extern crate are considered -// improper. - -use types::{NonExhaustiveEnum, NonExhaustiveVariants, NormalStruct, TupleStruct, UnitStruct}; - -extern "C" { - pub fn non_exhaustive_enum(_: NonExhaustiveEnum); - //~^ ERROR `extern` block uses type `NonExhaustiveEnum`, which is not FFI-safe - pub fn non_exhaustive_normal_struct(_: NormalStruct); - //~^ ERROR `extern` block uses type `NormalStruct`, which is not FFI-safe - pub fn non_exhaustive_unit_struct(_: UnitStruct); - //~^ ERROR `extern` block uses type `UnitStruct`, which is not FFI-safe - pub fn non_exhaustive_tuple_struct(_: TupleStruct); - //~^ ERROR `extern` block uses type `TupleStruct`, which is not FFI-safe - pub fn non_exhaustive_variant(_: NonExhaustiveVariants); - //~^ ERROR `extern` block uses type `NonExhaustiveVariants`, which is not FFI-safe -} - -fn main() {} diff --git a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr b/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr deleted file mode 100644 index 43c8e1015..000000000 --- a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr +++ /dev/null @@ -1,47 +0,0 @@ -error: `extern` block uses type `NonExhaustiveEnum`, which is not FFI-safe - --> $DIR/extern_crate_improper.rs:12:35 - | -LL | pub fn non_exhaustive_enum(_: NonExhaustiveEnum); - | ^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: this enum is non-exhaustive -note: the lint level is defined here - --> $DIR/extern_crate_improper.rs:2:9 - | -LL | #![deny(improper_ctypes)] - | ^^^^^^^^^^^^^^^ - -error: `extern` block uses type `NormalStruct`, which is not FFI-safe - --> $DIR/extern_crate_improper.rs:14:44 - | -LL | pub fn non_exhaustive_normal_struct(_: NormalStruct); - | ^^^^^^^^^^^^ not FFI-safe - | - = note: this struct is non-exhaustive - -error: `extern` block uses type `UnitStruct`, which is not FFI-safe - --> $DIR/extern_crate_improper.rs:16:42 - | -LL | pub fn non_exhaustive_unit_struct(_: UnitStruct); - | ^^^^^^^^^^ not FFI-safe - | - = note: this struct is non-exhaustive - -error: `extern` block uses type `TupleStruct`, which is not FFI-safe - --> $DIR/extern_crate_improper.rs:18:43 - | -LL | pub fn non_exhaustive_tuple_struct(_: TupleStruct); - | ^^^^^^^^^^^ not FFI-safe - | - = note: this struct is non-exhaustive - -error: `extern` block uses type `NonExhaustiveVariants`, which is not FFI-safe - --> $DIR/extern_crate_improper.rs:20:38 - | -LL | pub fn non_exhaustive_variant(_: NonExhaustiveVariants); - | ^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: this enum has non-exhaustive variants - -error: aborting due to 5 previous errors - diff --git a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs b/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs deleted file mode 100644 index fe4ae345d..000000000 --- a/tests/ui/rfc-2008-non-exhaustive/improper_ctypes/same_crate_proper.rs +++ /dev/null @@ -1,48 +0,0 @@ -// check-pass -#![deny(improper_ctypes)] - -// This test checks that non-exhaustive types with `#[repr(C)]` are considered proper within -// the defining crate. - -#[non_exhaustive] -#[repr(C)] -pub enum NonExhaustiveEnum { - Unit, - Tuple(u32), - Struct { field: u32 }, -} - -#[non_exhaustive] -#[repr(C)] -pub struct NormalStruct { - pub first_field: u16, - pub second_field: u16, -} - -#[non_exhaustive] -#[repr(C)] -pub struct UnitStruct; - -#[non_exhaustive] -#[repr(C)] -pub struct TupleStruct(pub u16, pub u16); - -#[repr(C)] -pub enum NonExhaustiveVariants { - #[non_exhaustive] - Unit, - #[non_exhaustive] - Tuple(u32), - #[non_exhaustive] - Struct { field: u32 }, -} - -extern "C" { - // Unit structs aren't tested here because they will trigger `improper_ctypes` anyway. - pub fn non_exhaustive_enum(_: NonExhaustiveEnum); - pub fn non_exhaustive_normal_struct(_: NormalStruct); - pub fn non_exhaustive_tuple_struct(_: TupleStruct); - pub fn non_exhaustive_variant(_: NonExhaustiveVariants); -} - -fn main() {} |