Skip to content

improper_ctypes complains about types that contain PhantomData #34798

Closed
@Ms2ger

Description

@Ms2ger
#[repr(C)]
pub struct Foo(::std::marker::PhantomData<i32>);
extern {
    pub fn f(foo: *mut Foo);
}
fn main() {}
warning: found non-foreign-function-safe member in struct marked #[repr(C)]: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type, #[warn(improper_ctypes)] on by default
 --> <anon>:5:19
5 |>     pub fn f(foo: *mut Foo);
  |>                   ^^^^^^^^

This comes up in bindings generated from C code that contains unions (the __BindgenUnionField type).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions