Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tests for non-exhaustive C-like enums in FFI #132303

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ pub enum NonExhaustiveCLikeEnum {
Four = 4,
Five = 5,
}

#[repr(C)]
pub struct NormalStructWithNonExhaustiveCLikeEnum {
one: u8,
two: NonExhaustiveCLikeEnum,
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern crate types;

use types::{
NonExhaustiveCLikeEnum, NonExhaustiveEnum, NonExhaustiveVariants,
NormalStruct, TupleStruct, UnitStruct,
NormalStruct, TupleStruct, UnitStruct, NormalStructWithNonExhaustiveCLikeEnum
};

extern "C" {
Expand All @@ -27,6 +27,9 @@ extern "C" {
// These should pass without remark, as they're C-compatible, despite being "non-exhaustive".
extern "C" {
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() {}
Loading