More test for non-exhaustive C-like enums in FFI
Add a few more possibly false-positive tests for the `improper_ctypes` lint
This commit is contained in:
parent
3f1be1ec7e
commit
a645342720
@ -38,3 +38,9 @@ pub enum NonExhaustiveCLikeEnum {
|
|||||||
Four = 4,
|
Four = 4,
|
||||||
Five = 5,
|
Five = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct NormalStructWithNonExhaustiveCLikeEnum {
|
||||||
|
one: u8,
|
||||||
|
two: NonExhaustiveCLikeEnum,
|
||||||
|
}
|
||||||
|
@ -8,7 +8,7 @@ extern crate types;
|
|||||||
|
|
||||||
use types::{
|
use types::{
|
||||||
NonExhaustiveCLikeEnum, NonExhaustiveEnum, NonExhaustiveVariants,
|
NonExhaustiveCLikeEnum, NonExhaustiveEnum, NonExhaustiveVariants,
|
||||||
NormalStruct, TupleStruct, UnitStruct,
|
NormalStruct, TupleStruct, UnitStruct, NormalStructWithNonExhaustiveCLikeEnum
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -27,6 +27,9 @@ extern "C" {
|
|||||||
// These should pass without remark, as they're C-compatible, despite being "non-exhaustive".
|
// These should pass without remark, as they're C-compatible, despite being "non-exhaustive".
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn non_exhaustive_c_compat_enum(_: NonExhaustiveCLikeEnum);
|
pub fn non_exhaustive_c_compat_enum(_: NonExhaustiveCLikeEnum);
|
||||||
|
pub fn non_exhaustive_c_compat_enum_ret() -> *mut NonExhaustiveCLikeEnum;
|
||||||
|
pub fn struct_w_non_exhaustive_c_like_enum(_: NormalStructWithNonExhaustiveCLikeEnum);
|
||||||
|
pub fn struct_w_non_exhaustive_c_like_enum_ret() -> *mut NormalStructWithNonExhaustiveCLikeEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user